Alien-FreeImage
view release on metacpan or search on metacpan
src/Source/OpenEXR/IlmImf/ImfDeepTiledOutputFile.cpp view on Meta::CPAN
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
vector<TileBuffer*> tileBuffers;
Int64 tileOffsetsPosition; // position of the tile index
TileMap tileMap; // the map of buffered tiles
TileCoord nextTileToWrite;
int partNumber; // the output part number
char* sampleCountSliceBase; // the pointer to the number
// of samples in each pixel
int sampleCountXStride; // the x stride for sampleCountSliceBase
int sampleCountYStride; // the y stride for sampleCountSliceBase
int sampleCountXTileCoords; // using x coordinates relative to current tile
int sampleCountYTileCoords; // using y coordinates relative to current tile
Int64 maxSampleCountTableSize;// the max size in bytes for a pixel
// sample count table
OutputStreamMutex* _streamData;
bool _deleteStream;
Data (int numThreads);
~Data ();
inline TileBuffer * getTileBuffer (int number);
// hash function from tile
// buffer coords into our
// vector of tile buffers
int& getSampleCount(int x, int y);
// get the number of samples
// in each pixel
TileCoord nextTileCoord (const TileCoord &a);
};
DeepTiledOutputFile::Data::Data (int numThreads):
numXTiles(0),
numYTiles(0),
tileOffsetsPosition (0),
partNumber(-1),
_streamData(NULL),
_deleteStream(true)
{
//
// 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));
for (size_t i = 0; i < tileBuffers.size(); i++)
tileBuffers[i] = 0;
}
DeepTiledOutputFile::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++)
if (tileBuffers[i] != 0)
delete tileBuffers[i];
for (size_t i = 0; i < slices.size(); i++)
delete slices[i];
}
int&
DeepTiledOutputFile::Data::getSampleCount(int x, int y)
{
return sampleCount(sampleCountSliceBase,
sampleCountXStride,
sampleCountYStride,
x, y);
}
TileBuffer*
DeepTiledOutputFile::Data::getTileBuffer (int number)
{
return tileBuffers[number % tileBuffers.size()];
}
TileCoord
DeepTiledOutputFile::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++;
( run in 0.759 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )