Skip to content

Commit ebdfd1d

Browse files
author
Grok Compression
committed
logging: simplify
1 parent 090b173 commit ebdfd1d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1139
-1203
lines changed

src/lib/core/cache/LengthCache.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ bool TileInfo::checkResize(void)
6666
markerInfo = nullptr;
6767
allocatedMarkers = 0;
6868
numMarkers = 0;
69-
Logger::logger_.error("Not enough memory to add TLM marker");
69+
grklog.error("Not enough memory to add TLM marker");
7070
return false;
7171
}
7272
markerInfo = new_marker;
@@ -215,7 +215,7 @@ bool CodeStreamInfo::seekFirstTilePart(uint16_t tile_index)
215215
// move just past SOT marker of first tile part for this tile
216216
if(!(stream->seek(tileInfoForTile->getTilePartInfo(0)->startPosition + MARKER_BYTES)))
217217
{
218-
Logger::logger_.error("Error in seek");
218+
grklog.error("Error in seek");
219219
return false;
220220
}
221221

src/lib/core/cache/PLMarkerMgr.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void PLMarkerMgr::pushInit(bool isFinal)
6565
bool PLMarkerMgr::pushPL(uint32_t len)
6666
{
6767
assert(len);
68-
// Logger::logger_.info("Push packet length: %u", len);
68+
// grklog.info("Push packet length: %u", len);
6969
uint32_t numbits = floorlog2(len) + 1;
7070
uint32_t numBytes = (numbits + 6) / 7;
7171
assert(numBytes <= 5);
@@ -110,7 +110,7 @@ bool PLMarkerMgr::pushPL(uint32_t len)
110110
{
111111
// write period
112112
// static int count = 0;
113-
// Logger::logger_.info("Wrote PLT packet %u, length %u", count++,len);
113+
// grklog.info("Wrote PLT packet %u, length %u", count++,len);
114114
uint8_t temp[5];
115115
int32_t counter = (int32_t)(numBytes - 1);
116116
temp[counter--] = (len & 0x7F);
@@ -192,7 +192,7 @@ bool PLMarkerMgr::findMarker(uint32_t nextIndex, bool compress)
192192
{
193193
if(rawMarkers_->size() > 256)
194194
{
195-
Logger::logger_.error("PLT: sequential marker assumption has been broken.");
195+
grklog.error("PLT: sequential marker assumption has been broken.");
196196
return false;
197197
}
198198
}
@@ -253,7 +253,7 @@ uint32_t PLMarkerMgr::pop(void)
253253

254254
if(currMarkerIter_ == rawMarkers_->end())
255255
{
256-
Logger::logger_.error("Attempt to pop PLT beyond PLT marker range.");
256+
grklog.error("Attempt to pop PLT beyond PLT marker range.");
257257
return 0;
258258
}
259259
if(currMarkerIter_ != rawMarkers_->end() && currMarkerBuf_)
@@ -287,7 +287,7 @@ uint32_t PLMarkerMgr::pop(void)
287287
}
288288

289289
// static int count = 0;
290-
// Logger::logger_.info("Read PLT packet %u, length %u", count++,rc);
290+
// grklog.info("Read PLT packet %u, length %u", count++,rc);
291291
return rc;
292292
}
293293

src/lib/core/canvas/Precinct.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ PrecinctImpl::PrecinctImpl(bool isCompressor, grk_rect32* bounds, grk_pt32 cblk_
2828
ceildivpow2<uint32_t>(bounds->y1, cblk_expn.y));
2929
if(!cblk_grid_.valid())
3030
{
31-
Logger::logger_.error("Invalid code block grid");
31+
grklog.error("Invalid code block grid");
3232
throw std::exception();
3333
}
3434
}
@@ -97,7 +97,7 @@ TagTreeU16* PrecinctImpl::getIncludeTagTree(void)
9797
}
9898
catch([[maybe_unused]] const std::exception& e)
9999
{
100-
Logger::logger_.warn("No incltree created.");
100+
grklog.warn("No incltree created.");
101101
throw;
102102
}
103103
}
@@ -122,7 +122,7 @@ TagTreeU8* PrecinctImpl::getIMsbTagTree(void)
122122
}
123123
catch([[maybe_unused]] const std::exception& e)
124124
{
125-
Logger::logger_.warn("No imsbtree created.");
125+
grklog.warn("No imsbtree created.");
126126
throw;
127127
}
128128
}

src/lib/core/canvas/SparseCanvas.h

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ class SparseCanvas : public ISparseCanvas
123123
blockWinWidth = (std::min<uint32_t>)(blockWinWidth, win.x1 - x);
124124
if(!grid.contains(gridX, gridY))
125125
{
126-
Logger::logger_.warn("sparse canvas : attempt to allocate a block (%u,%u) outside block "
127-
"grid bounds (%u,%u,%u,%u)",
128-
gridX, gridY, grid.x0, grid.y0, grid.x1, grid.y1);
126+
grklog.warn("sparse canvas : attempt to allocate a block (%u,%u) outside block "
127+
"grid bounds (%u,%u,%u,%u)",
128+
gridX, gridY, grid.x0, grid.y0, grid.x1, grid.y1);
129129
return false;
130130
}
131131
auto srcBlock = getBlock(gridX, gridY);
@@ -163,10 +163,10 @@ class SparseCanvas : public ISparseCanvas
163163

164164
if(!isWindowValid(win))
165165
{
166-
Logger::logger_.warn(
167-
"Sparse canvas @ res %u, attempt to read/write invalid window (%u,%u,%u,%u) "
168-
"for bounds (%u,%u,%u,%u).",
169-
resno, win.x0, win.y0, win.x1, win.y1, bounds.x0, bounds.y0, bounds.x1, bounds.y1);
166+
grklog.warn("Sparse canvas @ res %u, attempt to read/write invalid window (%u,%u,%u,%u) "
167+
"for bounds (%u,%u,%u,%u).",
168+
resno, win.x0, win.y0, win.x1, win.y1, bounds.x0, bounds.y0, bounds.x1,
169+
bounds.y1);
170170
return false;
171171
}
172172
assert(spacingY != 0 || win.height() == 1);
@@ -188,22 +188,20 @@ class SparseCanvas : public ISparseCanvas
188188
blockWinWidth = (std::min<uint32_t>)(blockWinWidth, win.x1 - x);
189189
if(!grid.contains(gridX, gridY))
190190
{
191-
Logger::logger_.warn(
192-
"sparse canvas @ resno %u, Attempt to access a block (%u,%u) outside "
193-
"block grid bounds",
194-
resno, gridX, gridY);
191+
grklog.warn("sparse canvas @ resno %u, Attempt to access a block (%u,%u) outside "
192+
"block grid bounds",
193+
resno, gridX, gridY);
195194
return false;
196195
}
197196
auto srcBlock = getBlock(gridX, gridY);
198197
if(!srcBlock)
199198
{
200-
Logger::logger_.warn(
201-
"sparse canvas @ resno %u, %s op: missing block (%u,%u,%u,%u) for %s "
202-
"(%u,%u,%u,%u). Skipping.",
203-
resno, isReadOperation ? "read" : "write", bounds.x0 + gridX * blockWidth,
204-
bounds.y0 + gridY * blockHeight, bounds.x0 + (gridX + 1) * blockWidth,
205-
bounds.y0 + (gridY + 1) * blockHeight, isReadOperation ? "read" : "write", win.x0,
206-
win.y0, win.x1, win.y1);
199+
grklog.warn("sparse canvas @ resno %u, %s op: missing block (%u,%u,%u,%u) for %s "
200+
"(%u,%u,%u,%u). Skipping.",
201+
resno, isReadOperation ? "read" : "write", bounds.x0 + gridX * blockWidth,
202+
bounds.y0 + gridY * blockHeight, bounds.x0 + (gridX + 1) * blockWidth,
203+
bounds.y0 + (gridY + 1) * blockHeight, isReadOperation ? "read" : "write",
204+
win.x0, win.y0, win.x1, win.y1);
207205
continue;
208206
}
209207
if(isReadOperation)
@@ -218,9 +216,9 @@ class SparseCanvas : public ISparseCanvas
218216
#ifdef GRK_DEBUG_VALGRIND
219217
size_t val = grk_memcheck<int32_t>(src + blockX, 1);
220218
if(val != grk_mem_ok)
221-
Logger::logger_.error("sparse canvas @resno %u, read block(%u,%u) : "
222-
"uninitialized at location (%u,%u)",
223-
resno, gridX, gridY, x + blockX, y_);
219+
grklog.error("sparse canvas @resno %u, read block(%u,%u) : "
220+
"uninitialized at location (%u,%u)",
221+
resno, gridX, gridY, x + blockX, y_);
224222
#endif
225223
dest[destInd] = src[blockX];
226224
destInd += spacingX;
@@ -246,9 +244,9 @@ class SparseCanvas : public ISparseCanvas
246244
grk_pt32 pt((uint32_t)(x + blockX), y_);
247245
size_t val = grk_memcheck<int32_t>(src + srcInd, 1);
248246
if(val != grk_mem_ok)
249-
Logger::logger_.error("sparse canvas @ resno %u, write block(%u,%u): "
250-
"uninitialized at location (%u,%u)",
251-
resno, gridX, gridY, x + blockX, y_);
247+
grklog.error("sparse canvas @ resno %u, write block(%u,%u): "
248+
"uninitialized at location (%u,%u)",
249+
resno, gridX, gridY, x + blockX, y_);
252250
}
253251
#endif
254252
dest[blockX] = src ? src[srcInd] : 0;

src/lib/core/canvas/Subband.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Precinct* Subband::createPrecinct(TileProcessor* tileProcessor, uint64_t precinc
7676
precinctGridWidth);
7777
if(!bounds.valid())
7878
{
79-
Logger::logger_.error("createPrecinct: invalid precinct bounds.");
79+
grklog.error("createPrecinct: invalid precinct bounds.");
8080
return nullptr;
8181
}
8282
auto currPrec = new Precinct(tileProcessor, bounds, cblk_expn);

src/lib/core/canvas/TileComponent.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,14 @@ bool TileComponent::init(TileProcessor* tileProcessor, grk_rect32 unreducedTileC
100100
uint64_t temp = (uint64_t)ceildivpow2<uint32_t>(res->x1, precWidthExp) << precWidthExp;
101101
if(temp > UINT_MAX)
102102
{
103-
Logger::logger_.error("Resolution x1 value %u must be less than 2^32", temp);
103+
grklog.error("Resolution x1 value %u must be less than 2^32", temp);
104104
return false;
105105
}
106106
allPrecinctsBounds.x1 = (uint32_t)temp;
107107
temp = (uint64_t)ceildivpow2<uint32_t>(res->y1, precHeightExp) << precHeightExp;
108108
if(temp > UINT_MAX)
109109
{
110-
Logger::logger_.error("Resolution y1 value %u must be less than 2^32", temp);
110+
grklog.error("Resolution y1 value %u must be less than 2^32", temp);
111111
return false;
112112
}
113113
allPrecinctsBounds.y1 = (uint32_t)temp;
@@ -316,10 +316,9 @@ bool TileComponent::canCreateWindow(grk_rect32 windowBounds)
316316
auto maxResolution = resolutions_ + numresolutions - 1;
317317
if(!maxResolution->intersection(windowBounds).valid())
318318
{
319-
Logger::logger_.error("Decompress region (%u,%u,%u,%u) must overlap image bounds (%u,%u,%u,%u)",
320-
windowBounds.x0, windowBounds.y0, windowBounds.x1, windowBounds.y1,
321-
maxResolution->x0, maxResolution->y0, maxResolution->x1,
322-
maxResolution->y1);
319+
grklog.error("Decompress region (%u,%u,%u,%u) must overlap image bounds (%u,%u,%u,%u)",
320+
windowBounds.x0, windowBounds.y0, windowBounds.x1, windowBounds.y1,
321+
maxResolution->x0, maxResolution->y0, maxResolution->x1, maxResolution->y1);
323322
return false;
324323
}
325324

0 commit comments

Comments
 (0)