Skip to content

Commit

Permalink
Fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vrabaud committed Feb 10, 2025
1 parent 2b39fcb commit 2ff8e4c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ The changes are relative to the previous release, unless the baseline is specifi
* Reject non-essential transformative properties.
* Treat avifenc --stdin as a regular positional file path argument.
* Allow YCgCo_Re and YCgCo_Ro decoding by default. Encoding is still conditioned
to the AVIF_ENABLE_YCGCO_R_ENCODING CMake flag.
to the AVIF_ENABLE_YCGCO_R_ENCODING CMake option.

## [1.1.1] - 2024-07-30

Expand Down
15 changes: 7 additions & 8 deletions apps/shared/avifjpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -938,20 +938,19 @@ static avifBool avifJPEGReadInternal(FILE * f,

avif->width = cinfo.output_width;
avif->height = cinfo.output_height;
const avifBool useYCgCoR = (avif->matrixCoefficients == AVIF_MATRIX_COEFFICIENTS_YCGCO_RE ||
avif->matrixCoefficients == AVIF_MATRIX_COEFFICIENTS_YCGCO_RO);
if (avif->matrixCoefficients == AVIF_MATRIX_COEFFICIENTS_YCGCO_RO) {
fprintf(stderr, "AVIF_MATRIX_COEFFICIENTS_YCGCO_RO cannot be used with JPEG because it has an even bit depth.\n");
goto cleanup;
}
if (avif->yuvFormat == AVIF_PIXEL_FORMAT_NONE) {
// Identity and YCgCo-R are only valid with YUV444.
avif->yuvFormat = (avif->matrixCoefficients == AVIF_MATRIX_COEFFICIENTS_IDENTITY || useYCgCoR)
avif->yuvFormat = (avif->matrixCoefficients == AVIF_MATRIX_COEFFICIENTS_IDENTITY ||
avif->matrixCoefficients == AVIF_MATRIX_COEFFICIENTS_YCGCO_RE)
? AVIF_PIXEL_FORMAT_YUV444
: AVIF_APP_DEFAULT_PIXEL_FORMAT;
}
avif->depth = requestedDepth ? requestedDepth : 8;
if (useYCgCoR) {
if (avif->matrixCoefficients == AVIF_MATRIX_COEFFICIENTS_YCGCO_RO) {
fprintf(stderr, "AVIF_MATRIX_COEFFICIENTS_YCGCO_RO cannot be used with JPEG because it has an even bit depth.\n");
goto cleanup;
}
if (avif->matrixCoefficients == AVIF_MATRIX_COEFFICIENTS_YCGCO_RE) {
if (requestedDepth && requestedDepth != 10) {
fprintf(stderr, "Cannot request %u bits for YCgCo-Re as it uses 2 extra bits.\n", requestedDepth);
goto cleanup;
Expand Down
2 changes: 1 addition & 1 deletion src/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -1636,7 +1636,7 @@ static avifResult avifValidateGrid(uint32_t gridCols,
"YCGCO_R is not enabled for encoding. "
"Please set AVIF_ENABLE_YCGCO_R_ENCODING in CMake. "
"cf https://github.com/AOMediaCodec/libavif/issues/2077.");
return AVIF_RESULT_INVALID_IMAGE_GRID;
return AVIF_RESULT_NOT_IMPLEMENTED;
}
#endif
const uint32_t expectedCellWidth = ((cellIndex + 1) % gridCols) ? tileWidth : bottomRightCell->width;
Expand Down
2 changes: 1 addition & 1 deletion tests/gtest/aviflosslesstest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ TEST(BasicTest, EncodeDecodeMatrixCoefficients) {

#if !defined(AVIF_ENABLE_YCGCO_R_ENCODING)
if (matrix_coefficient == AVIF_MATRIX_COEFFICIENTS_YCGCO_RE) {
ASSERT_NE(result, AVIF_RESULT_OK);
EXPECT_EQ(result, AVIF_RESULT_NOT_IMPLEMENTED);
continue;
}
#endif
Expand Down

0 comments on commit 2ff8e4c

Please sign in to comment.