TileCache.h
Go to the documentation of this file.
/*
* Copyright (C) 2016-2023 Grok Image Compression Inc.
*
* This source code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This source code 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <map>
namespace grk
{
struct TileProcessor;
class GrkImage;
#include "GrkImage.h"
struct TileCacheEntry
{
explicit TileCacheEntry(TileProcessor* p);
TileCacheEntry();
~TileCacheEntry();
TileProcessor* processor;
};
class TileCache
{
public:
TileCache(GRK_TILE_CACHE_STRATEGY strategy);
TileCache(void);
virtual ~TileCache();
bool empty(void);
void setStrategy(GRK_TILE_CACHE_STRATEGY strategy);
GRK_TILE_CACHE_STRATEGY getStrategy(void);
TileCacheEntry* put(uint16_t tileIndex, TileProcessor* processor);
TileCacheEntry* get(uint16_t tileIndex);
GrkImage* getComposite(void);
std::vector<GrkImage*> getAllImages(void);
std::vector<GrkImage*> getTileImages(void);
private:
// each component is sub-sampled and resolution-reduced
GrkImage* tileComposite;
std::map<uint32_t, TileCacheEntry*> cache_;
GRK_TILE_CACHE_STRATEGY strategy_;
};
} // namespace grk
GrkImage.h
grk::GrkImage
Definition GrkImage.h:25
grk::TileCache
Definition TileCache.h:38
grk::TileCache::getAllImages
std::vector< GrkImage * > getAllImages(void)
Definition TileCache.cpp:78
grk::TileCache::tileComposite
GrkImage * tileComposite
Definition TileCache.h:55
grk::TileCache::TileCache
TileCache(void)
Definition TileCache.cpp:31
grk::TileCache::getTileImages
std::vector< GrkImage * > getTileImages(void)
Definition TileCache.cpp:85
grk::TileCache::put
TileCacheEntry * put(uint16_t tileIndex, TileProcessor *processor)
Definition TileCache.cpp:43
grk::TileCache::~TileCache
virtual ~TileCache()
Definition TileCache.cpp:32
grk::TileCache::cache_
std::map< uint32_t, TileCacheEntry * > cache_
Definition TileCache.h:56
grk::TileCache::strategy_
GRK_TILE_CACHE_STRATEGY strategy_
Definition TileCache.h:57
grk::TileCache::setStrategy
void setStrategy(GRK_TILE_CACHE_STRATEGY strategy)
Definition TileCache.cpp:66
grk::TileCache::get
TileCacheEntry * get(uint16_t tileIndex)
Definition TileCache.cpp:59
grk::TileCache::getComposite
GrkImage * getComposite(void)
Definition TileCache.cpp:74
grk::TileCache::getStrategy
GRK_TILE_CACHE_STRATEGY getStrategy(void)
Definition TileCache.cpp:70
grk::TileCache::empty
bool empty(void)
Definition TileCache.cpp:39
GRK_TILE_CACHE_STRATEGY
enum _GRK_TILE_CACHE_STRATEGY GRK_TILE_CACHE_STRATEGY
grk
Copyright (C) 2016-2023 Grok Image Compression Inc.
Definition ICacheable.h:20
grk::grk_read
void grk_read(const uint8_t *buffer, TYPE *value, uint32_t numBytes)
Definition BufferedStream.h:239
grk::TileCacheEntry
Definition TileCache.h:29
grk::TileCacheEntry::processor
TileProcessor * processor
Definition TileCache.h:34
grk::TileCacheEntry::~TileCacheEntry
~TileCacheEntry()
Definition TileCache.cpp:23
grk::TileCacheEntry::TileCacheEntry
TileCacheEntry()
Definition TileCache.cpp:22
grk::TileProcessor
Definition TileProcessor.h:78