From 5b9a2fcf7fc0fa66ebee3a870972d3ce04c67180 Mon Sep 17 00:00:00 2001 From: Pam Harris Date: Wed, 18 Sep 2024 11:25:04 -0600 Subject: [PATCH] Fix Session channel range for loop and add debugging output --- src/Frame/Frame.cc | 2 ++ src/Session/Session.cc | 12 +++++++++--- src/Session/Session.h | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Frame/Frame.cc b/src/Frame/Frame.cc index 2c4c81ebe..8842c29f1 100644 --- a/src/Frame/Frame.cc +++ b/src/Frame/Frame.cc @@ -563,8 +563,10 @@ bool Frame::FillRasterTileData(CARTA::RasterTileData& raster_tile_data, const Ti tile_ptr->set_image_data(compression_buffer.data(), compressed_size); } + /* spdlog::debug( "The compression ratio for tile (layer:{}, x:{}, y:{}) is {:.3f}.", tile.layer, tile.x, tile.y, compression_ratio); + */ // Measure duration for compress tile data auto dt = t.Elapsed(); diff --git a/src/Session/Session.cc b/src/Session/Session.cc index b19509dff..eb1204cf8 100644 --- a/src/Session/Session.cc +++ b/src/Session/Session.cc @@ -741,14 +741,20 @@ void Session::OnSetImageChannels(const CARTA::SetImageChannels& message) { int end_channel(message.channel_range().max()); int nchan(frame->Depth()); for (int chan = start_channel; chan <= end_channel; ++chan) { - // Cancel if not in latest channel range or past last channel + // Cancel if past last channel + if (chan >= nchan) { + break; + } + // Cancel this channel but continue if not in latest channel range ImageChannelLock(file_id); bool cancel = !IsInChannelRange(file_id, chan); ImageChannelUnlock(file_id); - if (cancel || chan >= nchan) { - break; + if (cancel) { + spdlog::debug("OnSetImageChannels: channel_range channel {} not in current_range", chan); + continue; } + spdlog::debug("OnSetImageChannels: sending tiles for channel_range channel {}", chan); OnAddRequiredTiles(message.required_tiles(), chan); } } else { diff --git a/src/Session/Session.h b/src/Session/Session.h index c8a3caa1d..d84543a8b 100644 --- a/src/Session/Session.h +++ b/src/Session/Session.h @@ -105,6 +105,7 @@ class Session { if (message.has_current_range()) { // Clear queue if new range does not extend current range. AxisRange new_range(message.current_range().min(), message.current_range().max()); + spdlog::debug("Set current channel range {}-{}", new_range.from, new_range.to); clear_queue = SetChannelRange(file_id, new_range); } else { // Always clear queue and replace channel range (for cancel) for single channel.