Skip to content

Commit

Permalink
Remove debug logs and build wheels
Browse files Browse the repository at this point in the history
  • Loading branch information
emild authored and emild committed Mar 9, 2024
1 parent eccf188 commit 7d5ef58
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
3 changes: 0 additions & 3 deletions PhotoshopAPI/src/LayeredFile/LayerTypes/ImageLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ ImageLayer<T>::ImageLayer(std::unordered_map<Enum::ChannelID, std::vector<T>>&&
Layer<T>::m_Width = layerParameters.width;
Layer<T>::m_Height = layerParameters.height;

std::cout << "Constructing image layer with data" << std::endl;

// Construct a ChannelIDInfo for each of the channels and then an ImageLayer instance to hold the data
for (auto& [key, value] : imageData)
Expand All @@ -201,9 +200,7 @@ ImageLayer<T>::ImageLayer(std::unordered_map<Enum::ChannelID, std::vector<T>>&&
value.size(),
static_cast<uint64_t>(layerParameters.width) * layerParameters.height);
}
std::cout << "Generating channel: " << info.index << std::endl;
ImageChannel<T> channel = ImageChannel<T>(layerParameters.compression, std::move(value), info, layerParameters.width, layerParameters.height, layerParameters.posX, layerParameters.posY);
std::cout << "Generated channel: " << info.index << std::endl;
m_ImageData[info] = std::move(channel);
}

Expand Down
17 changes: 2 additions & 15 deletions PhotoshopAPI/src/Util/Struct/ImageChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ struct ImageChannel : public BaseImageChannel
{
PSAPI_LOG_ERROR("ImageChannel", "provided imageData does not match the expected size of %" PRIu64 " but is instead %i", static_cast<uint64_t>(width) * height, imageData.size());
}
std::cout << "Initializing image channel" << std::endl;

PROFILE_FUNCTION();
m_OrigByteSize = static_cast<uint64_t>(width) * height * sizeof(T);
Expand Down Expand Up @@ -123,31 +122,22 @@ struct ImageChannel : public BaseImageChannel

// Initialize our schunk
m_Data = blosc2_schunk_new(&storage);

std::cout << "Set up blosc schunk" << std::endl;

uint64_t remainingSize = static_cast<uint64_t>(width) * height * sizeof(T);
for (int nchunk = 0; nchunk < numChunks; ++nchunk)
{
std::cout << "Iterating chunk: " << nchunk << std::endl;
// Cast to uint8_t* to iterate by bytes, not by T
void* ptr = reinterpret_cast<uint8_t*>(imageData.data()) + nchunk * m_ChunkSize;
std::cout << "Offset from start: " << nchunk * m_ChunkSize << std::endl;
int64_t nchunks;
if (remainingSize > m_ChunkSize)
{
// C-blos2 returns the total number of chunks here
std::cout << "Preparing to append: " << m_ChunkSize << " bytes to buffer" << std::endl;
// C-blosc2 returns the total number of chunks here
nchunks = blosc2_schunk_append_buffer(m_Data, ptr, m_ChunkSize);
remainingSize -= m_ChunkSize;
}
else
{
// C-blos2 returns the total number of chunks here
std::cout << "Preparing to append: " << remainingSize << " bytes to buffer" << std::endl;
std::vector<uint8_t> tmpVec(remainingSize, 0);
std::cout << "Generated temporary vector" << std::endl;
nchunks = blosc2_schunk_append_buffer(m_Data, tmpVec.data(), remainingSize);
nchunks = blosc2_schunk_append_buffer(m_Data, ptr, remainingSize);
remainingSize = 0;
}
if (nchunks != nchunk + 1) [[unlikely]]
Expand All @@ -156,9 +146,6 @@ struct ImageChannel : public BaseImageChannel
}
}


std::cout << "Filled blosc2 schunk" << std::endl;

// Log the total compressed / uncompressed size to later determine our stats
REGISTER_COMPRESSION_TRACK(static_cast<uint64_t>(m_Data->cbytes), static_cast<uint64_t>(m_Data->nbytes));
};
Expand Down

0 comments on commit 7d5ef58

Please sign in to comment.