Skip to content

Commit 430f90e

Browse files
committed
Update implementation to only update fixed entries
When a partial reconstruction happens, only update the fixed entries. If it is a complete reconstruction, can copy full array blindly. Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
1 parent 341a8c7 commit 430f90e

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/lib/OpenEXRCore/chunk.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ reconstruct_chunk_table (
424424
uint64_t offset_start, chunk_start, max_offset;
425425
uint64_t* curctable;
426426
exr_const_priv_part_t curpart = NULL;
427-
int found_ci, computed_ci, partnum = 0, lastreconstruct = -1;
427+
int found_ci, computed_ci, partnum = 0;
428428
size_t chunkbytes;
429429

430430
curpart = ctxt->parts[ctxt->num_parts - 1];
@@ -486,18 +486,24 @@ reconstruct_chunk_table (
486486
chunk_start = 0;
487487
if (firstfailrv == EXR_ERR_SUCCESS) firstfailrv = rv;
488488
}
489-
else
490-
{
491-
lastreconstruct = ci;
492-
}
493489

494490
if (found_ci >= 0 && found_ci < part->chunk_count)
495491
{
496492
if (curctable[found_ci] == 0) curctable[found_ci] = chunk_start;
497493
}
498494
}
499-
if (lastreconstruct >= 0)
495+
if (firstfailrv == EXR_ERR_SUCCESS)
496+
{
500497
memcpy (chunktable, curctable, chunkbytes);
498+
}
499+
else
500+
{
501+
for (int ci = 0; ci < part->chunk_count; ++ci)
502+
{
503+
if ( curctable[ci] != 0 )
504+
chunktable[ci] = curctable[ci];
505+
}
506+
}
501507
ctxt->free_fn (curctable);
502508

503509
return firstfailrv;

0 commit comments

Comments
 (0)