Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/lib/OpenEXRCore/internal_ht.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,15 @@ ht_undo_impl (
if (static_cast<std::size_t>(decode->channel_count) != cs_to_file_ch.size ())
return EXR_ERR_CORRUPT_CHUNK;

std::vector<bool> seen (decode->channel_count, false);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally, we'd avoid an additional memory alloc here - we could put the seen flag into the CodestreamChannelInfo struct which is internal, which would reduce it back to just the one alloc in the vector of those (and in #2440 I put that vector into the context object to avoid an allocation every decode)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can reduce the number of new allocations to one: see #2516.

I am not super excited to add scratch fields, which are hard to maintain and explain.

for (int cs_i = 0; cs_i < decode->channel_count; cs_i++)
{
int file_i = cs_to_file_ch[cs_i].file_index;
if (file_i >= decode->channel_count)
return EXR_ERR_CORRUPT_CHUNK;
if (seen[file_i])
return EXR_ERR_CORRUPT_CHUNK;
seen[file_i] = true;

int64_t computedoffset = 0;
for (int i = 0; i < file_i; ++i)
Expand Down
Loading