Alien-FreeImage
view release on metacpan or search on metacpan
src/Source/OpenEXR/IlmImf/ImfTiledOutputFile.cpp view on Meta::CPAN
struct TiledOutputFile::Data
{
Header header; // the image header
int version; // file format version
bool multipart; // part came from a multipart file
TileDescription tileDesc; // describes the tile layout
FrameBuffer frameBuffer; // framebuffer to write into
Int64 previewPosition;
LineOrder lineOrder; // the file's lineorder
int minX; // data window's min x coord
int maxX; // data window's max x coord
int minY; // data window's min y coord
int maxY; // data window's max x coord
int numXLevels; // number of x levels
int numYLevels; // number of y levels
int * numXTiles; // number of x tiles at a level
int * numYTiles; // number of y tiles at a level
TileOffsets tileOffsets; // stores offsets in file for
// each tile
Compressor::Format format; // compressor's data format
vector<TOutSliceInfo> slices; // info about channels in file
size_t maxBytesPerTileLine; // combined size of a tile line
// over all channels
vector<TileBuffer*> tileBuffers;
size_t tileBufferSize; // size of a tile buffer
Int64 tileOffsetsPosition; // position of the tile index
TileMap tileMap;
TileCoord nextTileToWrite;
int partNumber; // the output part number
Data (int numThreads);
~Data ();
inline TileBuffer * getTileBuffer (int number);
// hash function from tile
// buffer coords into our
// vector of tile buffers
TileCoord nextTileCoord (const TileCoord &a);
};
TiledOutputFile::Data::Data (int numThreads):
multipart(false),
numXTiles(0),
numYTiles(0),
tileOffsetsPosition (0),
partNumber(-1)
{
//
// We need at least one tileBuffer, but if threading is used,
// to keep n threads busy we need 2*n tileBuffers
//
tileBuffers.resize (max (1, 2 * numThreads));
}
TiledOutputFile::Data::~Data ()
{
delete [] numXTiles;
delete [] numYTiles;
//
// Delete all the tile buffers, if any still happen to exist
//
for (TileMap::iterator i = tileMap.begin(); i != tileMap.end(); ++i)
delete i->second;
for (size_t i = 0; i < tileBuffers.size(); i++)
delete tileBuffers[i];
}
TileBuffer*
TiledOutputFile::Data::getTileBuffer (int number)
{
return tileBuffers[number % tileBuffers.size()];
}
TileCoord
TiledOutputFile::Data::nextTileCoord (const TileCoord &a)
{
TileCoord b = a;
if (lineOrder == INCREASING_Y)
{
b.dx++;
if (b.dx >= numXTiles[b.lx])
{
b.dx = 0;
b.dy++;
if (b.dy >= numYTiles[b.ly])
{
//
// the next tile is in the next level
//
b.dy = 0;
switch (tileDesc.mode)
{
case ONE_LEVEL:
case MIPMAP_LEVELS:
b.lx++;
b.ly++;
break;
( run in 0.600 second using v1.01-cache-2.11-cpan-5a3173703d6 )