Skip to content

Commit

Permalink
Fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vrabaud committed Feb 7, 2025
1 parent e267d0e commit 7c8a1b9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,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 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 7c8a1b9

Please sign in to comment.