Skip to content

Commit

Permalink
Fix Session channel range for loop and add debugging output
Browse files Browse the repository at this point in the history
  • Loading branch information
pford committed Sep 18, 2024
1 parent 485ad70 commit 5b9a2fc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/Frame/Frame.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
12 changes: 9 additions & 3 deletions src/Session/Session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions src/Session/Session.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 5b9a2fc

Please sign in to comment.