Skip to content

Commit

Permalink
Rename AVIF_ENABLE_YCGCO_R to AVIF_ENABLE_YCGCO_R_ENCODING
Browse files Browse the repository at this point in the history
  • Loading branch information
vrabaud committed Aug 27, 2024
1 parent 4c65a40 commit 9e435b8
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-linux-static-old-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
-DAVIF_LOCAL_LIBSHARPYUV=ON -DAVIF_LOCAL_LIBXML2=ON -DAVIF_LOCAL_LIBYUV=ON
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_LOCAL_GTEST=ON
-DAVIF_ENABLE_YCGCO_R=ON
-DAVIF_ENABLE_YCGCO_R_ENCODING=ON
-DAVIF_ENABLE_EXPERIMENTAL_GAIN_MAP=ON
-DAVIF_ENABLE_EXPERIMENTAL_MINI=ON
-DAVIF_ENABLE_WERROR=ON
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-unix-static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
-DAVIF_LIBSHARPYUV=LOCAL -DAVIF_LIBXML2=LOCAL -DAVIF_LIBYUV=LOCAL
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_ENABLE_YCGCO_R=ON
-DAVIF_ENABLE_YCGCO_R_ENCODING=ON
-DAVIF_ENABLE_EXPERIMENTAL_GAIN_MAP=ON
-DAVIF_ENABLE_EXPERIMENTAL_MINI=ON
-DAVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM=ON
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-windows-installed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
-DAVIF_LIBYUV=SYSTEM -DAVIF_ZLIBPNG=SYSTEM
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_ENABLE_YCGCO_R=ON
-DAVIF_ENABLE_YCGCO_R_ENCODING=ON
-DAVIF_ENABLE_EXPERIMENTAL_GAIN_MAP=ON
-DAVIF_ENABLE_EXPERIMENTAL_MINI=ON
-DAVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM=ON
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
-DAVIF_LIBYUV=LOCAL -DAVIF_ZLIBPNG=LOCAL
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_ENABLE_YCGCO_R=ON
-DAVIF_ENABLE_YCGCO_R_ENCODING=ON
-DAVIF_ENABLE_EXPERIMENTAL_GAIN_MAP=ON
-DAVIF_ENABLE_EXPERIMENTAL_MINI=ON
-DAVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM=ON
Expand Down
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ The changes are relative to the previous release, unless the baseline is specifi
is true.
* Write an empty HandlerBox name field instead of "libavif" (saves 7 bytes).
* Update svt.cmd/svt.sh/LocalSvt.cmake: v2.2.0
* Allow YCgCo_Re and YCgCo_Ro decoding by default. Encoding is still conditioned
to the AVIF_ENABLE_YCGCO_R_ENCODING CMake flag.

## [1.1.1] - 2024-07-30

Expand Down Expand Up @@ -149,8 +151,6 @@ The changes are relative to the previous release, unless the baseline is specifi
index_size.
* 'infe' boxes with an item_type different from 'mime' and without a
null-terminated item_name are now considered invalid as per ISO/IEC 14496-12.
* Allow YCgCo_Re and YCgCo_Ro decoding by default. Encoding is still conditioned
to the AVIF_ENABLE_EXPERIMENTAL_YCGCO CMake flag.

## [1.0.4] - 2024-02-08

Expand Down Expand Up @@ -232,7 +232,7 @@ List of incompatible ABI changes in this release:
* Add experimental support for AV2 behind the compilation flag AVIF_CODEC_AVM.
AVIF_CODEC_CHOICE_AVM is now part of avifCodecChoice.
* Add experimental YCgCo-R support behind the compilation flag
AVIF_ENABLE_YCGCO_R.
AVIF_ENABLE_EXPERIMENTAL_YCGCO_R.
* Allow lossless 4:0:0 on grayscale input.
* Add avifenc --no-overwrite flag to avoid overwriting output file.
* Add avifenc --clli flag to set clli.
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ option(BUILD_SHARED_LIBS "Build shared avif library" ON)

option(AVIF_ENABLE_WERROR "Treat all compiler warnings as errors" OFF)

option(AVIF_ENABLE_YCGCO_R "Enable experimental YCgCo-R matrix code for encoding" OFF)
option(AVIF_ENABLE_YCGCO_R_ENCODING "Enable experimental YCgCo-R matrix code for encoding" OFF)
option(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP
"Enable experimental gain map code (for HDR images that look good both on HDR and SDR displays)" OFF
)
Expand Down Expand Up @@ -357,8 +357,8 @@ if(AVIF_ENABLE_COVERAGE)
endif()
endif()

if(AVIF_ENABLE_YCGCO_R)
add_compile_definitions(AVIF_ENABLE_YCGCO_R)
if(AVIF_ENABLE_YCGCO_R_ENCODING)
add_compile_definitions(AVIF_ENABLE_YCGCO_R_ENCODING)
endif()

if(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP)
Expand Down
8 changes: 4 additions & 4 deletions apps/avifenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1936,12 +1936,12 @@ int main(int argc, char * argv[])
// Matrix coefficients.
if (settings.cicpExplicitlySet) {
avifBool incompatibleMC = (settings.matrixCoefficients != AVIF_MATRIX_COEFFICIENTS_IDENTITY);
#if defined(AVIF_ENABLE_YCGCO_R)
#if defined(AVIF_ENABLE_YCGCO_R_ENCODING)
incompatibleMC &= (settings.matrixCoefficients != AVIF_MATRIX_COEFFICIENTS_YCGCO_RE &&
settings.matrixCoefficients != AVIF_MATRIX_COEFFICIENTS_YCGCO_RO);
#endif
if (incompatibleMC) {
#if defined(AVIF_ENABLE_YCGCO_R)
#if defined(AVIF_ENABLE_YCGCO_R_ENCODING)
fprintf(stderr, "Matrix coefficients have to be identity, YCgCo-Re, or YCgCo-Ro in lossless mode.\n");
#else
fprintf(stderr, "Matrix coefficients have to be identity in lossless mode.\n");
Expand Down Expand Up @@ -2374,12 +2374,12 @@ int main(int argc, char * argv[])
}

avifBool matrixCoefficientsAreLosslessCompatible = usingIdentityMatrix;
#if defined(AVIF_ENABLE_YCGCO_R)
#if defined(AVIF_ENABLE_YCGCO_R_ENCODING)
matrixCoefficientsAreLosslessCompatible |= (image->matrixCoefficients == AVIF_MATRIX_COEFFICIENTS_YCGCO_RE ||
image->matrixCoefficients == AVIF_MATRIX_COEFFICIENTS_YCGCO_RO);
#endif
if (!matrixCoefficientsAreLosslessCompatible && !using400) {
#if defined(AVIF_ENABLE_YCGCO_R)
#if defined(AVIF_ENABLE_YCGCO_R_ENCODING)
fprintf(stderr, "WARNING: [--lossless] Input data was RGB and matrixCoefficients isn't set to identity (--cicp x/x/0) or YCgCo-Re/Ro (--cicp x/x/15 or x/x/16); Output might not be lossless.\n");
#else
fprintf(stderr, "WARNING: [--lossless] Input data was RGB and matrixCoefficients isn't set to identity (--cicp x/x/0); Output might not be lossless.\n");
Expand Down
5 changes: 3 additions & 2 deletions src/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -1548,12 +1548,12 @@ static avifResult avifValidateGrid(uint32_t gridCols,
cellImage = cellImage->gainMap->image;
}
#endif
#if !defined(AVIF_ENABLE_YCGCO_R)
#if !defined(AVIF_ENABLE_YCGCO_R_ENCODING)
if (cellImage->matrixCoefficients == AVIF_MATRIX_COEFFICIENTS_YCGCO_RE ||
cellImage->matrixCoefficients == AVIF_MATRIX_COEFFICIENTS_YCGCO_RO) {
avifDiagnosticsPrintf(diag,
"YCGCO_R is not enabled for encoding. "
"Please set AVIF_ENABLE_YCGCO_R in CMake. "
"Please set AVIF_ENABLE_YCGCO_R_ENCODING in CMake. "
"cf https://github.com/AOMediaCodec/libavif/issues/2077.");
return AVIF_RESULT_INVALID_IMAGE_GRID;
}
Expand Down Expand Up @@ -2005,6 +2005,7 @@ static avifResult avifEncoderAddImageInternal(avifEncoder * encoder,
}
cellImage = cellImagePlaceholder;
}

const avifBool isAlpha = avifIsAlpha(item->itemCategory);
int quantizer = isAlpha ? encoder->data->quantizerAlpha
#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP)
Expand Down
2 changes: 1 addition & 1 deletion tests/gtest/aviflosslesstest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ TEST(BasicTest, EncodeDecodeMatrixCoefficients) {
avifResult result =
avifEncoderWrite(encoder.get(), image.get(), &encoded);

#if !defined(AVIF_ENABLE_YCGCO_R)
#if !defined(AVIF_ENABLE_YCGCO_R_ENCODING)
if (matrix_coefficient == AVIF_MATRIX_COEFFICIENTS_YCGCO_RE) {
ASSERT_NE(result, AVIF_RESULT_OK);
continue;
Expand Down

0 comments on commit 9e435b8

Please sign in to comment.