Skip to content

Commit

Permalink
Fix off-by-one error in a comment
Browse files Browse the repository at this point in the history
The deduplication code in avifEncoderWriteMediaDataBox() handles
item->encodeOutput->samples.count == 1 and
item->encodeOutput->samples.count == 0, so the unhandled case should be
item->encodeOutput->samples.count > 1, not
item->encodeOutput->samples.count > 0.
  • Loading branch information
wantehchang committed Jan 23, 2024
1 parent a98fa4f commit c7023c6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -1815,8 +1815,8 @@ static avifResult avifEncoderWriteMediaDataBox(avifEncoder * encoder,

size_t chunkOffset = 0;

// Deduplication - See if an identical chunk to this has already been written
// Doing it when item->encodeOutput->samples.count > 0 would require contiguous memory.
// Deduplication - See if an identical chunk to this has already been written.
// Doing it when item->encodeOutput->samples.count > 1 would require contiguous memory.
if (item->encodeOutput->samples.count == 1) {
avifEncodeSample * sample = &item->encodeOutput->samples.sample[0];
chunkOffset = avifEncoderFindExistingChunk(s, mdatStartOffset, sample->data.data, sample->data.size);
Expand Down

0 comments on commit c7023c6

Please sign in to comment.