Skip to content

Commit

Permalink
Minor cleanup of avifEncoderWrite(). (#110)
Browse files Browse the repository at this point in the history
1. Delete the comnent "Reformat pixels, if need be" because the
RGB-to-YUV conversion code is gone. Replace it with the comment
"Validate image".

2. Return AVIF_RESULT_NO_YUV_FORMAT_SELECTED if image->yuvFormat is
AVIF_PIXEL_FORMAT_NONE. This is the error code returned by the original
code (before v0.6.0).
  • Loading branch information
wantehchang authored Mar 11, 2020
1 parent 7db1d05 commit cbfab6b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,18 @@ avifResult avifEncoderWrite(avifEncoder * encoder, avifImage * image, avifRWData
avifRWStreamStart(&s, output);

// -----------------------------------------------------------------------
// Reformat pixels, if need be
// Validate image

if (!image->width || !image->height || (image->yuvFormat == AVIF_PIXEL_FORMAT_NONE) || !image->yuvPlanes[AVIF_CHAN_Y]) {
if (!image->width || !image->height || !image->yuvPlanes[AVIF_CHAN_Y]) {
result = AVIF_RESULT_NO_CONTENT;
goto writeCleanup;
}

if (image->yuvFormat == AVIF_PIXEL_FORMAT_NONE) {
result = AVIF_RESULT_NO_YUV_FORMAT_SELECTED;
goto writeCleanup;
}

// -----------------------------------------------------------------------
// Encode AV1 OBUs

Expand Down

0 comments on commit cbfab6b

Please sign in to comment.