Skip to content

Commit

Permalink
Add note about buffer copy in avifDecoderRead() (#2056)
Browse files Browse the repository at this point in the history
  • Loading branch information
y-guyon authored Mar 19, 2024
1 parent 43ec9ac commit 1c92dbb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/read.c
Original file line number Diff line number Diff line change
Expand Up @@ -5590,6 +5590,12 @@ avifResult avifDecoderRead(avifDecoder * decoder, avifImage * image)
if (result != AVIF_RESULT_OK) {
return result;
}
// If decoder->image->imageOwnsYUVPlanes is true and decoder->image is not used after this call,
// the ownership of the planes in decoder->image could be transferred here instead of copied.
// However most codec_*.c implementations allocate the output buffer themselves and return a
// view, unless some postprocessing is applied (container-level grid reconstruction for
// example), so the first condition rarely holds.
// The second condition does not hold either: it is not required by the documentation in avif.h.
return avifImageCopy(image, decoder->image, AVIF_PLANES_ALL);
}

Expand Down

0 comments on commit 1c92dbb

Please sign in to comment.