diff --git a/.github/workflows/ci-fuzztest.yml b/.github/workflows/ci-fuzztest.yml index 02de76d639..48f13f8b93 100644 --- a/.github/workflows/ci-fuzztest.yml +++ b/.github/workflows/ci-fuzztest.yml @@ -50,7 +50,7 @@ jobs: -DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON -DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL -DAVIF_ENABLE_EXPERIMENTAL_YCGCO_R=ON - -DAVIF_ENABLE_EXPERIMENTAL_GAIN_MAP=ON + -DAVIF_ENABLE_GAIN_MAP=ON -DAVIF_ENABLE_EXPERIMENTAL_MINI=ON -DAVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM=ON -DAVIF_ENABLE_FUZZTEST=ON diff --git a/.github/workflows/ci-linux-golden-tests.yml b/.github/workflows/ci-linux-golden-tests.yml index 7a270d4fd0..c869467a83 100644 --- a/.github/workflows/ci-linux-golden-tests.yml +++ b/.github/workflows/ci-linux-golden-tests.yml @@ -46,7 +46,7 @@ jobs: -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DAVIF_CODEC_AOM=LOCAL -DAVIF_LIBYUV=LOCAL -DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON - -DAVIF_ENABLE_EXPERIMENTAL_GAIN_MAP=ON + -DAVIF_ENABLE_GAIN_MAP=ON -DAVIF_LIBXML2=LOCAL -DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GOLDEN_TESTS=ON -DAVIF_ENABLE_GTEST=OFF -DAVIF_ENABLE_WERROR=ON diff --git a/.github/workflows/ci-linux-static-old-local.yml b/.github/workflows/ci-linux-static-old-local.yml index bca37787b1..52d03d384c 100644 --- a/.github/workflows/ci-linux-static-old-local.yml +++ b/.github/workflows/ci-linux-static-old-local.yml @@ -51,7 +51,7 @@ jobs: -DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON -DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_LOCAL_GTEST=ON -DAVIF_ENABLE_EXPERIMENTAL_YCGCO_R=ON - -DAVIF_ENABLE_EXPERIMENTAL_GAIN_MAP=ON + -DAVIF_ENABLE_GAIN_MAP=ON -DAVIF_ENABLE_EXPERIMENTAL_MINI=ON -DAVIF_ENABLE_WERROR=ON - name: Build libavif (ninja) diff --git a/.github/workflows/ci-unix-shared-local.yml b/.github/workflows/ci-unix-shared-local.yml index 2f1ed513fe..13aba3602d 100644 --- a/.github/workflows/ci-unix-shared-local.yml +++ b/.github/workflows/ci-unix-shared-local.yml @@ -55,7 +55,7 @@ jobs: -DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON -DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL -DAVIF_ENABLE_EXPERIMENTAL_YCGCO_R=ON - -DAVIF_ENABLE_EXPERIMENTAL_GAIN_MAP=ON + -DAVIF_ENABLE_GAIN_MAP=ON -DAVIF_ENABLE_EXPERIMENTAL_MINI=ON -DAVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM=ON -DAVIF_ENABLE_WERROR=ON diff --git a/.github/workflows/ci-unix-static.yml b/.github/workflows/ci-unix-static.yml index bd09019f4c..5ed5257674 100644 --- a/.github/workflows/ci-unix-static.yml +++ b/.github/workflows/ci-unix-static.yml @@ -59,7 +59,7 @@ jobs: -DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON -DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL -DAVIF_ENABLE_EXPERIMENTAL_YCGCO_R=ON - -DAVIF_ENABLE_EXPERIMENTAL_GAIN_MAP=ON + -DAVIF_ENABLE_GAIN_MAP=ON -DAVIF_ENABLE_EXPERIMENTAL_MINI=ON -DAVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM=ON -DAVIF_ENABLE_WERROR=ON diff --git a/.github/workflows/ci-windows-installed.yml b/.github/workflows/ci-windows-installed.yml index fd88df21bc..d0072f07d8 100644 --- a/.github/workflows/ci-windows-installed.yml +++ b/.github/workflows/ci-windows-installed.yml @@ -74,7 +74,7 @@ jobs: -DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON -DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL -DAVIF_ENABLE_EXPERIMENTAL_YCGCO_R=ON - -DAVIF_ENABLE_EXPERIMENTAL_GAIN_MAP=ON + -DAVIF_ENABLE_GAIN_MAP=ON -DAVIF_ENABLE_EXPERIMENTAL_MINI=ON -DAVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM=ON -DAVIF_ENABLE_WERROR=ON $env:AVIF_CMAKE_C_COMPILER $env:AVIF_CMAKE_CXX_COMPILER diff --git a/.github/workflows/ci-windows-shared-local.yml b/.github/workflows/ci-windows-shared-local.yml index 08d749d2ff..c827962ef6 100644 --- a/.github/workflows/ci-windows-shared-local.yml +++ b/.github/workflows/ci-windows-shared-local.yml @@ -54,7 +54,7 @@ jobs: -DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON -DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL -DAVIF_ENABLE_EXPERIMENTAL_YCGCO_R=ON - -DAVIF_ENABLE_EXPERIMENTAL_GAIN_MAP=ON + -DAVIF_ENABLE_GAIN_MAP=ON -DAVIF_ENABLE_EXPERIMENTAL_MINI=ON -DAVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM=ON -DAVIF_ENABLE_WERROR=ON $env:AVIF_CMAKE_C_COMPILER $env:AVIF_CMAKE_CXX_COMPILER diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml index 9a73211382..14fe116f56 100644 --- a/.github/workflows/ci-windows.yml +++ b/.github/workflows/ci-windows.yml @@ -67,7 +67,7 @@ jobs: -DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON -DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL -DAVIF_ENABLE_EXPERIMENTAL_YCGCO_R=ON - -DAVIF_ENABLE_EXPERIMENTAL_GAIN_MAP=ON + -DAVIF_ENABLE_GAIN_MAP=ON -DAVIF_ENABLE_EXPERIMENTAL_MINI=ON -DAVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM=ON -DAVIF_ENABLE_WERROR=ON diff --git a/CHANGELOG.md b/CHANGELOG.md index e9ea1ce798..298c508e04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,8 @@ The changes are relative to the previous release, unless the baseline is specifi avifGainMapMetadataDouble structs. * Add avif(Un)SignedFraction structs and avifDoubleTo(Un)SignedFraction utility functions. +* Turn on the gain map API by default. Rename the compile flag from + AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP to AVIF_ENABLE_GAIN_MAP. ## [1.1.1] - 2024-07-30 diff --git a/CMakeLists.txt b/CMakeLists.txt index b54a208b57..9461d366cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,10 +64,11 @@ option(BUILD_SHARED_LIBS "Build shared avif library" ON) option(AVIF_ENABLE_WERROR "Treat all compiler warnings as errors" OFF) -option(AVIF_ENABLE_EXPERIMENTAL_YCGCO_R "Enable experimental YCgCo-R matrix code" 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 +option(AVIF_ENABLE_GAIN_MAP + "Enable gain map code (for HDR images that look good both on HDR and SDR displays)" ON ) + +option(AVIF_ENABLE_EXPERIMENTAL_YCGCO_R "Enable experimental YCgCo-R matrix code" OFF) option(AVIF_ENABLE_EXPERIMENTAL_MINI "Enable experimental reduced header" OFF) option(AVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM "Enable experimental sample transform code" OFF) @@ -272,11 +273,11 @@ if(AVIF_LIBSHARPYUV_ENABLED) endif(AVIF_LIBSHARPYUV_ENABLED) set_local_or_system_option( - "LIBXML2" "OFF" "Build libxml2 by providing your own copy inside the ext subdir. \ -libxml2 is used when AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP is ON" + "LIBXML2" "OFF" "Use libxml2. When enabled and AVIF_ENABLE_GAIN_MAP is ON, \ + allows converting jpeg files with gain maps to avif using avifenc" ) -if(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +if(AVIF_ENABLE_GAIN_MAP) check_avif_option(AVIF_LIBXML2 TARGET LibXml2::LibXml2 PKG_NAME LibXml2) endif() # --------------------------------------------------------------------------------------- @@ -364,8 +365,8 @@ if(AVIF_ENABLE_EXPERIMENTAL_YCGCO_R) add_compile_definitions(AVIF_ENABLE_EXPERIMENTAL_YCGCO_R) endif() -if(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) - add_compile_definitions(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +if(AVIF_ENABLE_GAIN_MAP) + add_compile_definitions(AVIF_ENABLE_GAIN_MAP) endif() if(AVIF_ENABLE_EXPERIMENTAL_MINI) @@ -396,7 +397,7 @@ set(AVIF_SRCS src/utils.c src/write.c ) -if(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +if(AVIF_ENABLE_GAIN_MAP) list(APPEND AVIF_SRCS src/gainmap.c) endif() if(AVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM) @@ -584,7 +585,7 @@ if(NOT AVIF_CODEC_AOM_ENABLED message(WARNING "libavif: No decoding library is enabled.") endif() -if(AVIF_LIB_USE_CXX OR (AVIF_BUILD_APPS AND AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) OR (AVIF_BUILD_TESTS AND (AVIF_ENABLE_FUZZTEST +if(AVIF_LIB_USE_CXX OR (AVIF_BUILD_APPS AND AVIF_ENABLE_GAIN_MAP) OR (AVIF_BUILD_TESTS AND (AVIF_ENABLE_FUZZTEST OR AVIF_ENABLE_GTEST)) ) enable_language(CXX) @@ -676,7 +677,7 @@ if(AVIF_BUILD_APPS OR (AVIF_BUILD_TESTS AND (AVIF_ENABLE_FUZZTEST OR AVIF_ENABLE find_package(JPEG REQUIRED) endif() - if(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) + if(AVIF_ENABLE_GAIN_MAP) if(TARGET LibXml2::LibXml2) set(AVIF_ENABLE_EXPERIMENTAL_JPEG_GAIN_MAP_CONVERSION TRUE) add_compile_definitions(AVIF_ENABLE_EXPERIMENTAL_JPEG_GAIN_MAP_CONVERSION) @@ -754,10 +755,8 @@ if(AVIF_BUILD_APPS) LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ) endif() - if(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) + if(AVIF_ENABLE_GAIN_MAP) include(LocalLibargparse) - set(AVIF_ENABLE_AVIFGAINMAPUTIL TRUE) - set(AVIFGAINMAPUTIL_SRCS apps/avifgainmaputil/avifgainmaputil.cc apps/avifgainmaputil/convert_command.cc diff --git a/apps/avifenc.c b/apps/avifenc.c index b98820d0db..367f8a1026 100644 --- a/apps/avifenc.c +++ b/apps/avifenc.c @@ -58,7 +58,7 @@ typedef struct avifBool ignoreColorProfile; // These settings are only relevant when compiled with AVIF_ENABLE_EXPERIMENTAL_JPEG_GAIN_MAP_CONVERSION - // (which also implies AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP). + // (which also implies AVIF_ENABLE_GAIN_MAP). avifBool qualityGainMapIsConstrained; // true if qualityGainMap explicitly set by the user int qualityGainMap; avifBool ignoreGainMap; // ignore any gain map present in the input file. diff --git a/apps/shared/avifjpeg.h b/apps/shared/avifjpeg.h index ad2a3f0c97..9c7d6d3d0a 100644 --- a/apps/shared/avifjpeg.h +++ b/apps/shared/avifjpeg.h @@ -15,7 +15,7 @@ extern "C" { // bytes of Exif or XMP metadata will be read or an error returned. // 'ignoreGainMap' is only relevant for jpeg files that have a gain map // and only if AVIF_ENABLE_EXPERIMENTAL_JPEG_GAIN_MAP_CONVERSION is ON -// (requires AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP and libxml2). Otherwise +// (requires AVIF_ENABLE_GAIN_MAP and libxml2). Otherwise // it has no effect. avifBool avifJPEGRead(const char * inputFilename, avifImage * avif, diff --git a/apps/shared/avifutil.c b/apps/shared/avifutil.c index fc36349e66..7591afd585 100644 --- a/apps/shared/avifutil.c +++ b/apps/shared/avifutil.c @@ -125,7 +125,7 @@ static void avifImageDumpInternal(const avifImage * avif, uint32_t gridCols, uin printf(" * CLLI : %hu, %hu\n", avif->clli.maxCLL, avif->clli.maxPALL); } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) printf(" * Gain map : "); avifImage * gainMapImage = avif->gainMap ? avif->gainMap->image : NULL; if (gainMapImage != NULL) { @@ -161,7 +161,7 @@ static void avifImageDumpInternal(const avifImage * avif, uint32_t gridCols, uin } else { printf("Absent\n"); } -#endif // AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP +#endif // AVIF_ENABLE_GAIN_MAP } void avifImageDump(const avifImage * avif, uint32_t gridCols, uint32_t gridRows, avifProgressiveState progressiveState) diff --git a/apps/shared/avifutil.h b/apps/shared/avifutil.h index 734ccf5f02..f396985823 100644 --- a/apps/shared/avifutil.h +++ b/apps/shared/avifutil.h @@ -67,7 +67,7 @@ struct y4mFrameIterator; // Returns AVIF_APP_FILE_FORMAT_UNKNOWN in case of error. // 'ignoreGainMap' is only relevant for jpeg files that have a gain map // and only if AVIF_ENABLE_EXPERIMENTAL_JPEG_GAIN_MAP_CONVERSION is ON -// (requires AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP and libxml2). Otherwise +// (requires AVIF_ENABLE_GAIN_MAP and libxml2). Otherwise // it has no effect. avifAppFileFormat avifReadImage(const char * filename, avifPixelFormat requestedFormat, diff --git a/include/avif/avif.h b/include/avif/avif.h index a34db7e3e3..f2bb05c19a 100644 --- a/include/avif/avif.h +++ b/include/avif/avif.h @@ -193,7 +193,7 @@ typedef enum AVIF_NODISCARD avifResult AVIF_RESULT_CANNOT_CHANGE_SETTING = 27, // a setting that can't change is changed during encoding AVIF_RESULT_INCOMPATIBLE_IMAGE = 28, // the image is incompatible with already encoded images AVIF_RESULT_INTERNAL_ERROR = 29, // some invariants have not been satisfied (likely a bug in libavif) -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) AVIF_RESULT_ENCODE_GAIN_MAP_FAILED = 30, AVIF_RESULT_DECODE_GAIN_MAP_FAILED = 31, AVIF_RESULT_INVALID_TONE_MAPPED_IMAGE = 32, @@ -590,7 +590,7 @@ typedef struct avifContentLightLevelInformationBox uint16_t maxPALL; } avifContentLightLevelInformationBox; -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) // --------------------------------------------------------------------------- // avifGainMap // Gain Maps are a solution for a consistent and adaptive display of HDR images. @@ -700,7 +700,7 @@ AVIF_API avifGainMap * avifGainMapCreate(void); // Frees a gain map, including the 'image' field if non NULL. AVIF_API void avifGainMapDestroy(avifGainMap * gainMap); -#endif // AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP +#endif // AVIF_ENABLE_GAIN_MAP // --------------------------------------------------------------------------- @@ -828,7 +828,7 @@ typedef struct avifImage avifImageItemProperty * properties; // NULL only if numProperties is 0. size_t numProperties; -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) // Gain map image and metadata. NULL if no gain map is present. // Owned by the avifImage and gets freed when calling avifImageDestroy(). // gainMap->image->transformFlags is always AVIF_TRANSFORM_NONE. @@ -840,10 +840,10 @@ typedef struct avifImage AVIF_NODISCARD AVIF_API avifImage * avifImageCreate(uint32_t width, uint32_t height, uint32_t depth, avifPixelFormat yuvFormat); AVIF_NODISCARD AVIF_API avifImage * avifImageCreateEmpty(void); // helper for making an image to decode into // Performs a deep copy of an image, including all metadata and planes, and the gain map metadata/planes if present -// and if AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP is defined. +// and if AVIF_ENABLE_GAIN_MAP is defined. AVIF_API avifResult avifImageCopy(avifImage * dstImage, const avifImage * srcImage, avifPlanesFlags planes); // Performs a shallow copy of a rectangular area of an image. 'dstImage' does not own the planes. -// Ignores the gainMap field (which exists only if AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP is defined). +// Ignores the gainMap field (which exists only if AVIF_ENABLE_GAIN_MAP is defined). AVIF_API avifResult avifImageSetViewRect(avifImage * dstImage, const avifImage * srcImage, const avifCropRect * rect); AVIF_API void avifImageDestroy(avifImage * image); @@ -857,7 +857,7 @@ AVIF_API avifResult avifImageSetMetadataExif(avifImage * image, const uint8_t * AVIF_API avifResult avifImageSetMetadataXMP(avifImage * image, const uint8_t * xmp, size_t xmpSize); // Allocate/free/steal planes. These functions ignore the gainMap field (which exists only if -// AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP is defined). +// AVIF_ENABLE_GAIN_MAP is defined). AVIF_API avifResult avifImageAllocatePlanes(avifImage * image, avifPlanesFlags planes); // Ignores any pre-existing planes AVIF_API void avifImageFreePlanes(avifImage * image, avifPlanesFlags planes); // Ignores already-freed planes AVIF_API void avifImageStealPlanes(avifImage * dstImage, avifImage * srcImage, avifPlanesFlags planes); @@ -1199,7 +1199,7 @@ typedef enum avifImageContentTypeFlag AVIF_IMAGE_CONTENT_NONE = 0, // Color only or alpha only is not currently supported. AVIF_IMAGE_CONTENT_COLOR_AND_ALPHA = (1 << 0) | (1 << 1), -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) AVIF_IMAGE_CONTENT_GAIN_MAP = (1 << 2), AVIF_IMAGE_CONTENT_ALL = AVIF_IMAGE_CONTENT_COLOR_AND_ALPHA | AVIF_IMAGE_CONTENT_GAIN_MAP, #else @@ -1394,7 +1394,7 @@ AVIF_API avifResult avifDecoderNthImageTiming(const avifDecoder * decoder, uint3 // function can be called next to retrieve the number of top rows that can be immediately accessed // from the luma plane of decoder->image, and alpha if any. The corresponding rows from the chroma planes, // if any, can also be accessed (half rounded up if subsampled, same number of rows otherwise). -// If a gain map is present and AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP is on and +// If a gain map is present and AVIF_ENABLE_GAIN_MAP is on and // (imageContentToDecode & AVIF_IMAGE_CONTENT_GAIN_MAP) is nonzero, the gain map's planes can also be accessed // in the same way. If the gain map's height is different from the main image, then the number of // available gain map rows is at least: @@ -1517,7 +1517,7 @@ typedef struct avifEncoder // Version 1.1.0 ends here. Add any new members after this line. -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) int qualityGainMap; // changeable encoder setting #endif @@ -1587,7 +1587,7 @@ AVIF_API avifResult avifEncoderFinish(avifEncoder * encoder, avifRWData * output // AVIF_RESULT_INVALID_CODEC_SPECIFIC_OPTION from avifEncoderWrite() or avifEncoderAddImage(). AVIF_API avifResult avifEncoderSetCodecSpecificOption(avifEncoder * encoder, const char * key, const char * value); -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) // Returns the size in bytes of the AV1 image item containing gain map samples, or 0 if no gain map was encoded. AVIF_API size_t avifEncoderGetGainMapSizeBytes(avifEncoder * encoder); #endif @@ -1605,7 +1605,7 @@ AVIF_API uint32_t avifImagePlaneHeight(const avifImage * image, int channel); // either the brand 'avif' or 'avis' (or both), without performing any allocations. AVIF_NODISCARD AVIF_API avifBool avifPeekCompatibleFileType(const avifROData * input); -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) // --------------------------------------------------------------------------- // Gain Map utilities. // Gain Maps are a HIGHLY EXPERIMENTAL FEATURE, see comments in the avifGainMap @@ -1658,7 +1658,7 @@ AVIF_API avifResult avifImageComputeGainMap(const avifImage * baseImage, avifGainMap * gainMap, avifDiagnostics * diag); -#endif // AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP +#endif // AVIF_ENABLE_GAIN_MAP #ifdef __cplusplus } // extern "C" diff --git a/include/avif/avif_cxx.h b/include/avif/avif_cxx.h index 176157c808..0a7ee95600 100644 --- a/include/avif/avif_cxx.h +++ b/include/avif/avif_cxx.h @@ -21,7 +21,7 @@ struct UniquePtrDeleter void operator()(avifEncoder * encoder) const { avifEncoderDestroy(encoder); } void operator()(avifDecoder * decoder) const { avifDecoderDestroy(decoder); } void operator()(avifImage * image) const { avifImageDestroy(image); } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) void operator()(avifGainMap * gainMap) const { avifGainMapDestroy(gainMap); } #endif }; @@ -31,7 +31,7 @@ using EncoderPtr = std::unique_ptr; using DecoderPtr = std::unique_ptr; using ImagePtr = std::unique_ptr; -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) using GainMapPtr = std::unique_ptr; #endif diff --git a/include/avif/internal.h b/include/avif/internal.h index 26e7e50689..44a4ae5c38 100644 --- a/include/avif/internal.h +++ b/include/avif/internal.h @@ -146,7 +146,7 @@ void avifImageCopyNoAlloc(avifImage * dstImage, const avifImage * srcImage); // Copies the samples from srcImage to dstImage. dstImage must be allocated. // srcImage and dstImage must have the same width, height, and depth. // If the AVIF_PLANES_YUV bit is set in planes, then srcImage and dstImage must have the same yuvFormat. -// Ignores the gainMap field (which exists only if AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP is defined). +// Ignores the gainMap field (which exists only if AVIF_ENABLE_GAIN_MAP is defined). void avifImageCopySamples(avifImage * dstImage, const avifImage * srcImage, avifPlanesFlags planes); // Appends an opaque image item property. @@ -391,7 +391,7 @@ typedef enum avifItemCategory { AVIF_ITEM_COLOR, AVIF_ITEM_ALPHA, -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) AVIF_ITEM_GAIN_MAP, #endif #if defined(AVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM) @@ -779,7 +779,7 @@ AVIF_NODISCARD avifBool avifSequenceHeaderParse(avifSequenceHeader * header, con // --------------------------------------------------------------------------- // gain maps -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) // Finds the approximate min/max values from the given gain map values, excluding outliers. // Uses a histogram, with outliers defined as having at least one empty bucket between them @@ -789,7 +789,7 @@ avifResult avifFindMinMaxWithoutOutliers(const float * gainMapF, int numPixels, avifResult avifGainMapValidateMetadata(const avifGainMap * gainMap, avifDiagnostics * diag); -#endif // AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP +#endif // AVIF_ENABLE_GAIN_MAP #define AVIF_INDEFINITE_DURATION64 UINT64_MAX #define AVIF_INDEFINITE_DURATION32 UINT32_MAX diff --git a/src/avif.c b/src/avif.c index 93c46033e6..1ae949fb46 100644 --- a/src/avif.c +++ b/src/avif.c @@ -104,7 +104,7 @@ const char * avifResultToString(avifResult result) case AVIF_RESULT_CANNOT_CHANGE_SETTING: return "Cannot change some setting during encoding"; case AVIF_RESULT_INCOMPATIBLE_IMAGE: return "The image is incompatible with already encoded images"; case AVIF_RESULT_INTERNAL_ERROR: return "Internal error"; -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) case AVIF_RESULT_ENCODE_GAIN_MAP_FAILED: return "Encoding of gain map planes failed"; case AVIF_RESULT_DECODE_GAIN_MAP_FAILED: return "Decoding of gain map planes failed"; case AVIF_RESULT_INVALID_TONE_MAPPED_IMAGE: return "Invalid tone mapped image item"; @@ -283,7 +283,7 @@ avifResult avifImageCopy(avifImage * dstImage, const avifImage * srcImage, avifP } avifImageCopySamples(dstImage, srcImage, planes); -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) if (srcImage->gainMap) { if (!dstImage->gainMap) { dstImage->gainMap = avifGainMapCreate(); @@ -320,7 +320,7 @@ avifResult avifImageCopy(avifImage * dstImage, const avifImage * srcImage, avifP avifGainMapDestroy(dstImage->gainMap); dstImage->gainMap = NULL; } -#endif // defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#endif // defined(AVIF_ENABLE_GAIN_MAP) return AVIF_RESULT_OK; } @@ -361,7 +361,7 @@ avifResult avifImageSetViewRect(avifImage * dstImage, const avifImage * srcImage void avifImageDestroy(avifImage * image) { -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) if (image->gainMap) { avifGainMapDestroy(image->gainMap); } @@ -1245,7 +1245,7 @@ void avifCodecVersions(char outBuffer[256]) } } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) avifGainMap * avifGainMapCreate(void) { avifGainMap * gainMap = (avifGainMap *)avifAlloc(sizeof(avifGainMap)); @@ -1280,4 +1280,4 @@ void avifGainMapDestroy(avifGainMap * gainMap) avifRWDataFree(&gainMap->altICC); avifFree(gainMap); } -#endif // AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP +#endif // AVIF_ENABLE_GAIN_MAP diff --git a/src/gainmap.c b/src/gainmap.c index 318a86d385..5f35411407 100644 --- a/src/gainmap.c +++ b/src/gainmap.c @@ -7,7 +7,7 @@ #include #include -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) static void avifGainMapSetDefaults(avifGainMap * gainMap) { @@ -849,4 +849,4 @@ avifResult avifImageComputeGainMap(const avifImage * baseImage, const avifImage return res; } -#endif // AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP +#endif // AVIF_ENABLE_GAIN_MAP diff --git a/src/read.c b/src/read.c index 9891c151c7..b317577d85 100644 --- a/src/read.c +++ b/src/read.c @@ -2016,7 +2016,7 @@ static avifBool avifParseImageGridBox(avifImageGrid * grid, return avifROStreamRemainingBytes(&s) == 0; } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) static avifBool avifParseGainMapMetadata(avifGainMap * gainMap, avifROStream * s) { @@ -2095,7 +2095,7 @@ static avifResult avifParseToneMappedImageBox(avifGainMap * gainMap, const uint8 return AVIF_RESULT_OK; } -#endif // AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP +#endif // AVIF_ENABLE_GAIN_MAP #if defined(AVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM) // bit_depth is assumed to be 2 (32-bit). @@ -2317,7 +2317,7 @@ static avifResult avifParseContentLightLevelInformationBox(avifProperty * prop, return AVIF_RESULT_OK; } -#if defined(AVIF_ENABLE_EXPERIMENTAL_MINI) && defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_EXPERIMENTAL_MINI) && defined(AVIF_ENABLE_GAIN_MAP) static avifResult avifSkipMasteringDisplayColourVolume(avifROStream * s) { for (int c = 0; c < 3; c++) { @@ -2418,7 +2418,7 @@ static avifResult avifParseMiniHDRProperties(avifROStream * s, uint32_t * hasCll } return AVIF_RESULT_OK; } -#endif // AVIF_ENABLE_EXPERIMENTAL_MINI && AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP +#endif // AVIF_ENABLE_EXPERIMENTAL_MINI && AVIF_ENABLE_GAIN_MAP // Implementation of section 2.3.3 of AV1 Codec ISO Media File Format Binding specification v1.2.0. // See https://aomediacodec.github.io/av1-isobmff/v1.2.0.html#av1codecconfigurationbox-syntax. @@ -3864,7 +3864,7 @@ static avifResult avifParseMinimizedImageBox(avifDecoderData * data, uint32_t hasClli = AVIF_FALSE, tmapHasClli = AVIF_FALSE; avifContentLightLevelInformationBox clli = {}, tmapClli = {}; if (hasHdr) { -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) AVIF_CHECKERR(avifROStreamReadBitsU32(&s, &hasGainmap, 1), AVIF_RESULT_BMFF_PARSE_FAILED); // bit(1) gainmap_flag; if (hasGainmap) { // avifDecoderReset() requires the 'tmap' brand to be registered for the tone mapping derived image item to be parsed. @@ -3932,7 +3932,7 @@ static avifResult avifParseMinimizedImageBox(avifDecoderData * data, } #else return AVIF_RESULT_NOT_IMPLEMENTED; -#endif // AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP +#endif // AVIF_ENABLE_GAIN_MAP } // Chunk sizes @@ -4410,7 +4410,7 @@ static avifResult avifParse(avifDecoder * decoder) avifBool miniSeen = AVIF_FALSE; avifBool needsMini = AVIF_FALSE; #endif -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) avifBool needsTmap = AVIF_FALSE; avifBool tmapSeen = AVIF_FALSE; #endif @@ -4532,7 +4532,7 @@ static avifResult avifParse(avifDecoder * decoder) AVIF_RESULT_BMFF_PARSE_FAILED); } #endif // AVIF_ENABLE_EXPERIMENTAL_MINI -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) needsTmap = avifFileTypeHasBrand(&ftyp, "tmap"); if (needsTmap) { needsMeta = AVIF_TRUE; @@ -4546,7 +4546,7 @@ static avifResult avifParse(avifDecoder * decoder) AVIF_CHECKRES(avifParseMetaBox(data->meta, boxOffset, boxContents.data, boxContents.size, data->diag)); metaSeen = AVIF_TRUE; -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) for (uint32_t itemIndex = 0; itemIndex < data->meta->items.count; ++itemIndex) { if (!memcmp(data->meta->items.item[itemIndex]->type, "tmap", 4)) { tmapSeen = AVIF_TRUE; @@ -4588,7 +4588,7 @@ static avifResult avifParse(avifDecoder * decoder) #if defined(AVIF_ENABLE_EXPERIMENTAL_MINI) sawEverythingNeeded = sawEverythingNeeded && (!needsMini || miniSeen); #endif -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) sawEverythingNeeded = sawEverythingNeeded && (!needsTmap || tmapSeen); #endif if (sawEverythingNeeded) { @@ -4601,7 +4601,7 @@ static avifResult avifParse(avifDecoder * decoder) if ((needsMeta && !metaSeen) || (needsMoov && !moovSeen)) { return AVIF_RESULT_TRUNCATED_DATA; } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) if (needsTmap && !tmapSeen) { return metaIsSizeZero ? AVIF_RESULT_TRUNCATED_DATA : AVIF_RESULT_BMFF_PARSE_FAILED; } @@ -4666,7 +4666,7 @@ avifBool avifPeekCompatibleFileType(const avifROData * input) return avifFileTypeIsCompatible(&ftyp); } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) static avifBool avifBrandArrayHasBrand(avifBrandArray * brands, const char * brand) { for (uint32_t brandIndex = 0; brandIndex < brands->count; ++brandIndex) { @@ -5280,7 +5280,7 @@ static avifResult avifReadColorProperties(avifIO * io, return avifReadColorNclxProperty(properties, colorPrimaries, transferCharacteristics, matrixCoefficients, yuvRange, cicpSet); } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) // Finds a 'tmap' (tone mapped image item) box associated with the given 'colorItem'. // If found, fills 'toneMappedImageItem' and sets 'gainMapItemID' to the id of the gain map // item associated with the box. Otherwise, sets 'toneMappedImageItem' to NULL. @@ -5465,7 +5465,7 @@ static avifResult aviDecoderCheckGainMapProperties(avifDecoder * decoder, const } return AVIF_RESULT_OK; } -#endif // AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP +#endif // AVIF_ENABLE_GAIN_MAP #if defined(AVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM) // Finds a 'sato' Sample Transform derived image item box. @@ -5598,7 +5598,7 @@ avifResult avifDecoderReset(avifDecoder * decoder) avifCodecType colorCodecType = AVIF_CODEC_TYPE_UNKNOWN; const avifPropertyArray * colorProperties = NULL; -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) const avifPropertyArray * gainMapProperties = NULL; #endif if (data->source == AVIF_DECODER_SOURCE_TRACKS) { @@ -5768,7 +5768,7 @@ avifResult avifDecoderReset(avifDecoder * decoder) &codecType[AVIF_ITEM_ALPHA])); } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) // Section 10.2.6 of 23008-12:2024/AMD 1:2024(E): // 'tmap' brand // This brand enables file players to identify and decode HEIF files containing tone-map derived image @@ -5805,7 +5805,7 @@ avifResult avifDecoderReset(avifDecoder * decoder) } } } -#endif // AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP +#endif // AVIF_ENABLE_GAIN_MAP #if defined(AVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM) // AVIF_ITEM_SAMPLE_TRANSFORM (not used through mainItems because not a coded item (well grids are not coded items either but it's different)). @@ -5956,7 +5956,7 @@ avifResult avifDecoderReset(avifDecoder * decoder) decoder->image->alphaPremultiplied = decoder->alphaPresent && (mainItems[AVIF_ITEM_COLOR]->premByID == mainItems[AVIF_ITEM_ALPHA]->id); -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) if (mainItems[AVIF_ITEM_GAIN_MAP]) { AVIF_ASSERT_OR_RETURN(decoder->image->gainMap && decoder->image->gainMap->image); decoder->image->gainMap->image->width = mainItems[AVIF_ITEM_GAIN_MAP]->width; @@ -6030,7 +6030,7 @@ avifResult avifDecoderReset(avifDecoder * decoder) decoder->image->transformFlags |= AVIF_TRANSFORM_IMIR; decoder->image->imir = imirProp->u.imir; } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) if (gainMapProperties != NULL) { AVIF_CHECKRES(aviDecoderCheckGainMapProperties(decoder, gainMapProperties)); } @@ -6149,7 +6149,7 @@ static avifResult avifImageLimitedToFullAlpha(avifImage * image) static avifResult avifGetErrorForItemCategory(avifItemCategory itemCategory) { -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) if (itemCategory == AVIF_ITEM_GAIN_MAP) { return AVIF_RESULT_DECODE_GAIN_MAP_FAILED; } @@ -6276,7 +6276,7 @@ static avifResult avifDecoderDecodeTiles(avifDecoder * decoder, uint32_t nextIma if (!stealPlanes) { avifImage * dstImage = decoder->image; -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) if (tile->input->itemCategory == AVIF_ITEM_GAIN_MAP) { AVIF_ASSERT_OR_RETURN(dstImage->gainMap && dstImage->gainMap->image); dstImage = dstImage->gainMap->image; @@ -6292,7 +6292,7 @@ static avifResult avifDecoderDecodeTiles(avifDecoder * decoder, uint32_t nextIma avifImage * src = tile->image; switch (tile->input->itemCategory) { -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) case AVIF_ITEM_GAIN_MAP: AVIF_ASSERT_OR_RETURN(decoder->image->gainMap && decoder->image->gainMap->image); decoder->image->gainMap->image->width = src->width; @@ -6319,7 +6319,7 @@ static avifResult avifDecoderDecodeTiles(avifDecoder * decoder, uint32_t nextIma if (avifIsAlpha(tile->input->itemCategory)) { avifImageStealPlanes(decoder->image, src, AVIF_PLANES_A); -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) } else if (tile->input->itemCategory == AVIF_ITEM_GAIN_MAP) { AVIF_ASSERT_OR_RETURN(decoder->image->gainMap && decoder->image->gainMap->image); avifImageStealPlanes(decoder->image->gainMap->image, src, AVIF_PLANES_YUV); @@ -6647,7 +6647,7 @@ uint32_t avifDecoderDecodedRowCount(const avifDecoder * decoder) { uint32_t minRowCount = decoder->image->height; for (int c = 0; c < AVIF_ITEM_CATEGORY_COUNT; ++c) { -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) if (c == AVIF_ITEM_GAIN_MAP) { const avifImage * const gainMap = decoder->image->gainMap ? decoder->image->gainMap->image : NULL; if ((decoder->imageContentToDecode & AVIF_IMAGE_CONTENT_GAIN_MAP) && gainMap != NULL && gainMap->height != 0) { diff --git a/src/write.c b/src/write.c index cf4e1c7932..8c4bb3a80b 100644 --- a/src/write.c +++ b/src/write.c @@ -214,7 +214,7 @@ typedef struct avifEncoderData // Map the encoder settings quality and qualityAlpha to quantizer and quantizerAlpha int quantizer; int quantizerAlpha; -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) int quantizerGainMap; #endif // tileRowsLog2 and tileColsLog2 are the actual tiling values after automatic tiling is handled @@ -229,7 +229,7 @@ typedef struct avifEncoderData int lastTileRowsLog2; int lastTileColsLog2; avifImage * imageMetadata; -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) // For convenience, holds metadata derived from the avifGainMap struct (when present) about the // altenate image avifImage * altImageMetadata; @@ -259,7 +259,7 @@ static avifEncoderData * avifEncoderDataCreate(void) if (!data->imageMetadata) { goto error; } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) data->altImageMetadata = avifImageCreateEmpty(); if (!data->altImageMetadata) { goto error; @@ -336,7 +336,7 @@ static void avifEncoderDataDestroy(avifEncoderData * data) if (data->imageMetadata) { avifImageDestroy(data->imageMetadata); } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) if (data->altImageMetadata) { avifImageDestroy(data->altImageMetadata); } @@ -467,7 +467,7 @@ avifEncoder * avifEncoderCreate(void) encoder->repetitionCount = AVIF_REPETITION_COUNT_INFINITE; encoder->quality = AVIF_QUALITY_DEFAULT; encoder->qualityAlpha = AVIF_QUALITY_DEFAULT; -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) encoder->qualityGainMap = AVIF_QUALITY_DEFAULT; #endif encoder->minQuantizer = AVIF_QUANTIZER_BEST_QUALITY; @@ -710,7 +710,7 @@ static avifResult avifEncoderWriteHDRProperties(avifRWStream * dedupStream, return AVIF_RESULT_OK; } -#if defined(AVIF_ENABLE_EXPERIMENTAL_MINI) && defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_EXPERIMENTAL_MINI) && defined(AVIF_ENABLE_GAIN_MAP) static avifResult avifEncoderWriteMiniHDRProperties(avifRWStream * outputStream, const avifImage * imageMetadata) { const avifBool hasClli = imageMetadata->clli.maxCLL != 0 || imageMetadata->clli.maxPALL != 0; @@ -747,7 +747,7 @@ static avifResult avifEncoderWriteMiniHDRProperties(avifRWStream * outputStream, } return AVIF_RESULT_OK; } -#endif // AVIF_ENABLE_EXPERIMENTAL_MINI && AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP +#endif // AVIF_ENABLE_EXPERIMENTAL_MINI && AVIF_ENABLE_GAIN_MAP static avifResult avifEncoderWriteExtendedColorProperties(avifRWStream * dedupStream, avifRWStream * outputStream, @@ -935,7 +935,7 @@ static avifResult avifWriteGridPayload(avifRWData * data, uint32_t gridCols, uin return AVIF_RESULT_OK; } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) static avifBool avifGainMapIdenticalChannels(const avifGainMap * gainMap) { @@ -1041,7 +1041,7 @@ static avifResult avifImageCopyAltImageMetadata(avifImage * altImageMetadata, co altImageMetadata->clli = imageWithGainMap->gainMap->altCLLI; return AVIF_RESULT_OK; } -#endif // AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP +#endif // AVIF_ENABLE_GAIN_MAP #if defined(AVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM) static avifResult avifEncoderWriteSampleTransformTokens(avifRWStream * s, const avifSampleTransformExpression * expression) @@ -1202,7 +1202,7 @@ static int avifQualityToQuantizer(int quality, int minQuantizer, int maxQuantize static const char infeNameColor[] = "Color"; static const char infeNameAlpha[] = "Alpha"; -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) static const char infeNameGainMap[] = "GMap"; #endif #if defined(AVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM) @@ -1214,7 +1214,7 @@ static const char * getInfeName(avifItemCategory itemCategory) if (avifIsAlpha(itemCategory)) { return infeNameAlpha; } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) if (itemCategory == AVIF_ITEM_GAIN_MAP) { return infeNameGainMap; } @@ -1563,7 +1563,7 @@ static avifBool avifEncoderDataShouldForceKeyframeForAlpha(const avifEncoderData static avifResult avifGetErrorForItemCategory(avifItemCategory itemCategory) { -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) if (itemCategory == AVIF_ITEM_GAIN_MAP) { return AVIF_RESULT_ENCODE_GAIN_MAP_FAILED; } @@ -1596,7 +1596,7 @@ static avifResult avifValidateGrid(uint32_t gridCols, const uint32_t cellCount = gridCols * gridRows; const avifImage * firstCell = cellImages[0]; const avifImage * bottomRightCell = cellImages[cellCount - 1]; -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) if (validateGainMap) { AVIF_ASSERT_OR_RETURN(firstCell->gainMap && firstCell->gainMap->image); firstCell = firstCell->gainMap->image; @@ -1610,7 +1610,7 @@ static avifResult avifValidateGrid(uint32_t gridCols, const uint32_t gridHeight = avifGridHeight(gridRows, firstCell, bottomRightCell); for (uint32_t cellIndex = 0; cellIndex < cellCount; ++cellIndex) { const avifImage * cellImage = cellImages[cellIndex]; -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) if (validateGainMap) { AVIF_ASSERT_OR_RETURN(cellImage->gainMap && cellImage->gainMap->image); cellImage = cellImage->gainMap->image; @@ -1709,7 +1709,7 @@ static avifResult avifEncoderAddImageInternal(avifEncoder * encoder, AVIF_CHECKRES(avifValidateGrid(gridCols, gridRows, cellImages, /*validateGainMap=*/AVIF_FALSE, &encoder->diag)); -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) const avifBool hasGainMap = (firstCell->gainMap && firstCell->gainMap->image != NULL); // Check that either all cells have a gain map, or none of them do. @@ -1775,7 +1775,7 @@ static avifResult avifEncoderAddImageInternal(avifEncoder * encoder, return AVIF_RESULT_INVALID_ARGUMENT; } } -#endif // AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP +#endif // AVIF_ENABLE_GAIN_MAP // ----------------------------------------------------------------------- // Validate flags @@ -1823,7 +1823,7 @@ static avifResult avifEncoderAddImageInternal(avifEncoder * encoder, // Map quality and qualityAlpha to quantizer and quantizerAlpha encoder->data->quantizer = avifQualityToQuantizer(encoder->quality, encoder->minQuantizer, encoder->maxQuantizer); encoder->data->quantizerAlpha = avifQualityToQuantizer(encoder->qualityAlpha, encoder->minQuantizerAlpha, encoder->maxQuantizerAlpha); -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) encoder->data->quantizerGainMap = avifQualityToQuantizer(encoder->qualityGainMap, AVIF_QUANTIZER_BEST_QUALITY, AVIF_QUANTIZER_WORST_QUALITY); #endif @@ -1858,7 +1858,7 @@ static avifResult avifEncoderAddImageInternal(avifEncoder * encoder, if (encoder->data->items.count == 0) { // Make a copy of the first image's metadata (sans pixels) for future writing/validation AVIF_CHECKRES(avifImageCopy(encoder->data->imageMetadata, firstCell, 0)); -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) if (hasGainMap) { AVIF_CHECKRES(avifImageCopyAltImageMetadata(encoder->data->altImageMetadata, encoder->data->imageMetadata)); } @@ -1907,7 +1907,7 @@ static avifResult avifEncoderAddImageInternal(avifEncoder * encoder, } } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) if (firstCell->gainMap && firstCell->gainMap->image) { avifEncoderItem * toneMappedItem = avifEncoderDataCreateItem(encoder->data, "tmap", @@ -1951,7 +1951,7 @@ static avifResult avifEncoderAddImageInternal(avifEncoder * encoder, colorItem->dimgFromID = toneMappedItemID; gainMapItem->dimgFromID = toneMappedItemID; } -#endif // AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP +#endif // AVIF_ENABLE_GAIN_MAP #if defined(AVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM) if (encoder->sampleTransformRecipe == AVIF_SAMPLE_TRANSFORM_BIT_DEPTH_EXTENSION_8B_8B || @@ -1959,7 +1959,7 @@ static avifResult avifEncoderAddImageInternal(avifEncoder * encoder, encoder->sampleTransformRecipe == AVIF_SAMPLE_TRANSFORM_BIT_DEPTH_EXTENSION_12B_8B_OVERLAP_4B) { // For now, only 16-bit depth is supported. AVIF_ASSERT_OR_RETURN(firstCell->depth == 16); -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) AVIF_CHECKERR(!firstCell->gainMap, AVIF_RESULT_NOT_IMPLEMENTED); // TODO(yguyon): Implement 16-bit HDR #endif AVIF_CHECKRES(avifEncoderCreateBitDepthExtensionItems(encoder, gridCols, gridRows, gridWidth, gridHeight, colorItemID)); @@ -1987,7 +1987,7 @@ static avifResult avifEncoderAddImageInternal(avifEncoder * encoder, } else { // Another frame in an image sequence, or layer in a layered image -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) if (hasGainMap) { avifDiagnosticsPrintf(&encoder->diag, "gain maps are not supported for image sequences or layered images"); return AVIF_RESULT_NOT_IMPLEMENTED; @@ -2037,7 +2037,7 @@ static avifResult avifEncoderAddImageInternal(avifEncoder * encoder, avifImage * cellImagePlaceholder = NULL; // May be used as a temporary, modified cellImage. Left as NULL otherwise. const avifImage * firstCellImage = firstCell; -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) if (item->itemCategory == AVIF_ITEM_GAIN_MAP) { AVIF_ASSERT_OR_RETURN(cellImage->gainMap && cellImage->gainMap->image); cellImage = cellImage->gainMap->image; @@ -2061,7 +2061,7 @@ static avifResult avifEncoderAddImageInternal(avifEncoder * encoder, const avifBool isAlpha = avifIsAlpha(item->itemCategory); int quantizer = isAlpha ? encoder->data->quantizerAlpha -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) : (item->itemCategory == AVIF_ITEM_GAIN_MAP) ? encoder->data->quantizerGainMap #endif : encoder->data->quantizer; @@ -2223,7 +2223,7 @@ static avifResult avifEncoderWriteMediaDataBox(avifEncoder * encoder, } const avifBool isAlpha = avifIsAlpha(item->itemCategory); const avifBool isAlphaOrGainMap = isAlpha -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) || item->itemCategory == AVIF_ITEM_GAIN_MAP #endif ; @@ -2267,7 +2267,7 @@ static avifResult avifEncoderWriteMediaDataBox(avifEncoder * encoder, encoder->ioStats.alphaOBUSize += sample->data.size; } else if (item->itemCategory == AVIF_ITEM_COLOR) { encoder->ioStats.colorOBUSize += sample->data.size; -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) } else if (item->itemCategory == AVIF_ITEM_GAIN_MAP) { encoder->data->gainMapSizeBytes += sample->data.size; #endif @@ -2389,7 +2389,7 @@ static avifBool avifEncoderIsMiniCompatible(const avifEncoder * encoder) encoder->data->imageMetadata->xmp.size > (1 << 20)) { return AVIF_FALSE; } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) // gainmap_width_minus1 and gainmap_height_minus1 if (encoder->data->imageMetadata->gainMap != NULL && encoder->data->imageMetadata->gainMap->image != NULL && (encoder->data->imageMetadata->gainMap->image->width > (1 << 15) || @@ -2414,7 +2414,7 @@ static avifBool avifEncoderIsMiniCompatible(const avifEncoder * encoder) encoder->data->imageMetadata->yuvFormat != AVIF_PIXEL_FORMAT_YUV400) { return AVIF_FALSE; } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) // gainmap_chroma_subsampling if (encoder->data->imageMetadata->gainMap != NULL && encoder->data->imageMetadata->gainMap->image != NULL && (encoder->data->imageMetadata->gainMap->image->yuvFormat != AVIF_PIXEL_FORMAT_YUV444 && @@ -2430,7 +2430,7 @@ static avifBool avifEncoderIsMiniCompatible(const avifEncoder * encoder) encoder->data->imageMetadata->matrixCoefficients > 255) { return AVIF_FALSE; } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) // gainmap_colour_primaries, gainmap_transfer_characteristics and gainmap_matrix_coefficients if (encoder->data->imageMetadata->gainMap != NULL && encoder->data->imageMetadata->gainMap->image != NULL && (encoder->data->imageMetadata->gainMap->image->colorPrimaries > 255 || @@ -2470,7 +2470,7 @@ static avifBool avifEncoderIsMiniCompatible(const avifEncoder * encoder) } continue; // The alpha auxiliary item can be stored in the MinimizedImageBox. } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) if (item->itemCategory == AVIF_ITEM_GAIN_MAP) { // gainmap_item_data_size if (item->encodeOutput->samples.count != 1 || item->encodeOutput->samples.sample[0].data.size >= (1 << 28)) { @@ -2541,7 +2541,7 @@ static avifResult avifEncoderWriteMiniBox(avifEncoder * encoder, avifRWStream * AVIF_ASSERT_OR_RETURN(!alphaItem); alphaItem = item; } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) if (item->itemCategory == AVIF_ITEM_GAIN_MAP) { AVIF_ASSERT_OR_RETURN(!gainmapItem); gainmapItem = item; @@ -2617,7 +2617,7 @@ static avifResult avifEncoderWriteMiniBox(avifEncoder * encoder, avifRWStream * uint32_t fewItemDataBytesFlag = colorData->size <= (1 << 15) && (!alphaData || alphaData->size < (1 << 15)); uint32_t fewMetadataBytesFlag = image->icc.size <= (1 << 10) && image->exif.size <= (1 << 10) && image->xmp.size <= (1 << 10); -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) if (hasGainmap) { AVIF_ASSERT_OR_RETURN(image->gainMap != NULL && image->gainMap->image != NULL); gainmapMetadataSize = avifGainMapMetadataSize(image->gainMap); @@ -2700,7 +2700,7 @@ static avifResult avifEncoderWriteMiniBox(avifEncoder * encoder, avifRWStream * // High Dynamic Range properties size_t tmapIccSize = 0; if (hasHdr) { -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) AVIF_CHECKRES(avifRWStreamWriteBits(s, hasGainmap, 1)); // bit(1) gainmap_flag; if (hasGainmap) { const avifImage * tmap = encoder->data->altImageMetadata; @@ -2760,7 +2760,7 @@ static avifResult avifEncoderWriteMiniBox(avifEncoder * encoder, avifRWStream * if (hasGainmap) { AVIF_CHECKRES(avifEncoderWriteMiniHDRProperties(s, encoder->data->altImageMetadata)); } -#endif // AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP +#endif // AVIF_ENABLE_GAIN_MAP } // Chunk sizes @@ -2773,7 +2773,7 @@ static avifResult avifEncoderWriteMiniBox(avifEncoder * encoder, avifRWStream * if (hasIcc) { AVIF_CHECKRES(avifRWStreamWriteBits(s, (uint32_t)image->icc.size - 1, fewMetadataBytesFlag ? 10 : 20)); // unsigned int(few_metadata_bytes_flag ? 10 : 20) icc_data_size_minus1; } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) if (hasHdr && hasGainmap && tmapIccSize != 0) { AVIF_CHECKRES(avifRWStreamWriteBits(s, (uint32_t)tmapIccSize - 1, fewMetadataBytesFlag ? 10 : 20)); // unsigned int(few_metadata_bytes_flag ? 10 : 20) tmap_icc_data_size_minus1; } @@ -2826,7 +2826,7 @@ static avifResult avifEncoderWriteMiniBox(avifEncoder * encoder, avifRWStream * if (hasIcc) { AVIF_CHECKRES(avifRWStreamWrite(s, image->icc.data, image->icc.size)); // unsigned int(8) icc_data[icc_data_size_minus1 + 1]; } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) if (hasHdr && hasGainmap && tmapIccSize != 0) { AVIF_CHECKRES(avifRWStreamWrite(s, encoder->data->altImageMetadata->icc.data, tmapIccSize)); // unsigned int(8) tmap_icc_data[tmap_icc_data_size_minus1 + 1]; } @@ -2872,7 +2872,7 @@ static avifResult avifRWStreamWriteProperties(avifItemPropertyDedup * const dedu const avifBool isGrid = (item->gridCols > 0); // Whether there is ipma to write for this item. avifBool hasIpmaToWrite = item->codec || isGrid; -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) const avifBool isToneMappedImage = !memcmp(item->type, "tmap", 4); if (isToneMappedImage) { hasIpmaToWrite = AVIF_TRUE; @@ -2914,7 +2914,7 @@ static avifResult avifRWStreamWriteProperties(avifItemPropertyDedup * const dedu } const avifImage * itemMetadata = imageMetadata; -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) if (isToneMappedImage) { itemMetadata = altImageMetadata; } else if (item->itemCategory == AVIF_ITEM_GAIN_MAP) { @@ -2943,7 +2943,7 @@ static avifResult avifRWStreamWriteProperties(avifItemPropertyDedup * const dedu // pixi = pixel information (depth, channel count) avifBool hasPixi = AVIF_TRUE; -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) // Pixi is optional for the 'tmap' item. if (isToneMappedImage && imageMetadata->gainMap->altDepth == 0 && imageMetadata->gainMap->altPlaneCount == 0) { hasPixi = AVIF_FALSE; @@ -3009,7 +3009,7 @@ static avifResult avifRWStreamWriteProperties(avifItemPropertyDedup * const dedu AVIF_CHECKRES(avifEncoderWriteColorProperties(s, itemMetadata, &item->ipma, dedup)); AVIF_CHECKRES(avifEncoderWriteHDRProperties(&dedup->s, s, itemMetadata, &item->ipma, dedup)); -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) } else if (item->itemCategory == AVIF_ITEM_GAIN_MAP) { // Gain map specific properties @@ -3246,7 +3246,7 @@ avifResult avifEncoderFinish(avifEncoder * encoder, avifRWData * output) AVIF_CHECKRES(avifRWStreamWriteChars(&s, "MA1A", 4)); // ... compatible_brands[] } } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) for (uint32_t itemIndex = 0; itemIndex < encoder->data->items.count; ++itemIndex) { if (!memcmp(encoder->data->items.item[itemIndex].type, "tmap", 4)) { // ISO/IEC 23008-12:2024/AMD 1:2024(E) @@ -3418,7 +3418,7 @@ avifResult avifEncoderFinish(avifEncoder * encoder, avifRWData * output) avifBoxMarker ipco; AVIF_CHECKRES(avifRWStreamWriteBox(&s, "ipco", AVIF_BOX_SIZE_TBD, &ipco)); avifImage * altImageMetadata = NULL; -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) altImageMetadata = encoder->data->altImageMetadata; #endif avifResult result = avifRWStreamWriteProperties(dedup, &s, encoder, imageMetadata, altImageMetadata); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 10deb513e7..ca34391916 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -113,7 +113,7 @@ if(AVIF_ENABLE_GTEST) add_avif_gtest_with_data(avifdimgtest avifincrtest_helpers) add_avif_gtest_with_data(avifencodetest) - if(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) + if(AVIF_ENABLE_GAIN_MAP) add_avif_internal_gtest_with_data(avifgainmaptest avifincrtest_helpers_internal) if(AVIF_ENABLE_EXPERIMENTAL_JPEG_GAIN_MAP_CONVERSION) @@ -131,7 +131,7 @@ if(AVIF_ENABLE_GTEST) add_avif_gtest_with_data(aviflosslesstest) add_avif_gtest_with_data(avifmetadatatest) - if(AVIF_ENABLE_EXPERIMENTAL_MINI AND AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) + if(AVIF_ENABLE_EXPERIMENTAL_MINI AND AVIF_ENABLE_GAIN_MAP) add_avif_gtest(avifminitest) endif() @@ -223,7 +223,7 @@ if(AVIF_ENABLE_FUZZTEST) add_avif_fuzztest(avif_fuzztest_read_image) add_avif_fuzztest(avif_fuzztest_yuvrgb) - if(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) + if(AVIF_ENABLE_GAIN_MAP) add_avif_fuzztest(avif_fuzztest_enc_dec_experimental) add_avif_fuzztest(avif_fuzztest_enc_dec_incr_experimental gtest/avifincrtest_helpers.cc) endif() @@ -271,7 +271,7 @@ if(AVIF_BUILD_APPS) ${CMAKE_CURRENT_SOURCE_DIR}/data ) - if(AVIF_ENABLE_AVIFGAINMAPUTIL AND AVIF_ENABLE_EXPERIMENTAL_JPEG_GAIN_MAP_CONVERSION) + if(AVIF_ENABLE_EXPERIMENTAL_JPEG_GAIN_MAP_CONVERSION) add_test(NAME test_cmd_avifgainmaputil COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/test_cmd_avifgainmaputil.sh ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/data ) @@ -371,10 +371,10 @@ if(AVIF_CODEC_AVM_ENABLED) PROPERTIES DISABLED True ) - if(AVIF_ENABLE_EXPERIMENTAL_MINI AND AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) + if(AVIF_ENABLE_EXPERIMENTAL_MINI AND AVIF_ENABLE_GAIN_MAP) set_tests_properties(avifminitest PROPERTIES DISABLED True) endif() - if(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) + if(AVIF_ENABLE_GAIN_MAP) set_tests_properties(avifgainmaptest PROPERTIES DISABLED True) if(AVIF_ENABLE_EXPERIMENTAL_JPEG_GAIN_MAP_CONVERSION) diff --git a/tests/data/README.md b/tests/data/README.md index 000550332b..e93c20da75 100644 --- a/tests/data/README.md +++ b/tests/data/README.md @@ -643,7 +643,7 @@ libavif and ignored by the tests. License: [same as libavif](https://github.com/AOMediaCodec/libavif/blob/main/LICENSE) Source : created from `seine_sdr_gainmap_srgb.jpg` converted to avif with avifenc built -with AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP and AVIF_ENABLE_LIBXML2 then: +with AVIF_ENABLE_GAIN_MAP and AVIF_ENABLE_LIBXML2 then: ``` # from libavif/mybuilddir/ diff --git a/tests/gtest/avif_fuzztest_helpers.cc b/tests/gtest/avif_fuzztest_helpers.cc index 69e30764f9..b46e85ab33 100644 --- a/tests/gtest/avif_fuzztest_helpers.cc +++ b/tests/gtest/avif_fuzztest_helpers.cc @@ -156,7 +156,7 @@ DecoderPtr CreateAvifDecoder(avifCodecChoice codec_choice, int max_threads, ImagePtr AvifImageToUniquePtr(avifImage* image) { return ImagePtr(image); } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) DecoderPtr AddGainMapOptionsToDecoder( DecoderPtr decoder, avifImageContentTypeFlags image_content_to_decode) { decoder->imageContentToDecode = image_content_to_decode; diff --git a/tests/gtest/avif_fuzztest_helpers.h b/tests/gtest/avif_fuzztest_helpers.h index ee577bd103..cfb5750d94 100644 --- a/tests/gtest/avif_fuzztest_helpers.h +++ b/tests/gtest/avif_fuzztest_helpers.h @@ -50,7 +50,7 @@ DecoderPtr CreateAvifDecoder(avifCodecChoice codec_choice, int max_threads, uint32_t image_dimension_limit, uint32_t image_count_limit, avifStrictFlags strict_flags); -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) DecoderPtr AddGainMapOptionsToDecoder( DecoderPtr decoder, avifImageContentTypeFlags image_content_to_decode); #endif @@ -169,7 +169,7 @@ inline auto ArbitraryAvifAnim() { return fuzztest::OneOf(ArbitraryAvifAnim8b(), ArbitraryAvifAnim16b()); } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) // TODO: Try StructOf(StructOf())? ImagePtr AddGainMapToImage( ImagePtr image, ImagePtr gain_map, int32_t gain_map_min_n0, @@ -278,7 +278,7 @@ inline auto ArbitraryBaseAvifDecoder() { AVIF_STRICT_ALPHA_ISPE_REQUIRED})); } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) // Generator for an arbitrary DecoderPtr with base options and gain map // options fuzzed. inline auto ArbitraryAvifDecoderWithGainMapOptions() { @@ -287,7 +287,7 @@ inline auto ArbitraryAvifDecoderWithGainMapOptions() { return fuzztest::Map(AddGainMapOptionsToDecoder, ArbitraryBaseAvifDecoder(), fuzztest::ElementOf({ AVIF_IMAGE_CONTENT_COLOR_AND_ALPHA -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) , AVIF_IMAGE_CONTENT_COLOR_AND_ALPHA | AVIF_IMAGE_CONTENT_GAIN_MAP #endif @@ -301,7 +301,7 @@ inline auto ArbitraryAvifDecoder() { #else // Generator for an arbitrary DecoderPtr. inline auto ArbitraryAvifDecoder() { return ArbitraryBaseAvifDecoder(); } -#endif // AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP +#endif // AVIF_ENABLE_GAIN_MAP //------------------------------------------------------------------------------ diff --git a/tests/gtest/avifincrtest_helpers.cc b/tests/gtest/avifincrtest_helpers.cc index 6c0a8b83e5..2a766bd7bf 100644 --- a/tests/gtest/avifincrtest_helpers.cc +++ b/tests/gtest/avifincrtest_helpers.cc @@ -65,7 +65,7 @@ void ComparePartialYuva(const avifImage& image1, const avifImage& image2, } } -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) if (image1.gainMap != nullptr && image1.gainMap->image != nullptr && image2.gainMap != nullptr && image2.gainMap->image != nullptr) { const uint32_t gain_map_row_count = (uint32_t)roundf( @@ -365,7 +365,7 @@ avifResult DecodeIncrementally(const avifRWData& encoded_avif, AVIF_CHECKERR(false, AVIF_RESULT_INVALID_ARGUMENT); } bool has_gain_map = false; -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) has_gain_map = (reference.gainMap != nullptr); #endif const uint32_t min_decoded_row_count = GetMinDecodedRowCount( diff --git a/tests/gtest/aviftest_helpers.cc b/tests/gtest/aviftest_helpers.cc index 7a3a360e84..47824ee7ae 100644 --- a/tests/gtest/aviftest_helpers.cc +++ b/tests/gtest/aviftest_helpers.cc @@ -510,7 +510,7 @@ AvifRwData Encode(const avifImage* image, int speed, int quality) { encoder->speed = speed; encoder->quality = quality; encoder->qualityAlpha = quality; -#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP) +#if defined(AVIF_ENABLE_GAIN_MAP) encoder->qualityGainMap = quality; #endif testutil::AvifRwData bytes;