Skip to content

Commit

Permalink
Turn gain map flag on by default.
Browse files Browse the repository at this point in the history
Remove 'EXPERIMENTAL' from its name.
  • Loading branch information
maryla-uc committed Nov 29, 2024
1 parent 378c646 commit 5b5d365
Show file tree
Hide file tree
Showing 27 changed files with 137 additions and 136 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-fuzztest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-linux-golden-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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_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)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-unix-shared-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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_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
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 @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-windows-shared-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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 @@ -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
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
27 changes: 13 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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()
# ---------------------------------------------------------------------------------------
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion apps/avifenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion apps/shared/avifjpeg.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions apps/shared/avifutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion apps/shared/avifutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
26 changes: 13 additions & 13 deletions include/avif/avif.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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

// ---------------------------------------------------------------------------

Expand Down Expand Up @@ -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.
Expand All @@ -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);

Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions include/avif/avif_cxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand All @@ -31,7 +31,7 @@ using EncoderPtr = std::unique_ptr<avifEncoder, UniquePtrDeleter>;
using DecoderPtr = std::unique_ptr<avifDecoder, UniquePtrDeleter>;
using ImagePtr = std::unique_ptr<avifImage, UniquePtrDeleter>;

#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP)
#if defined(AVIF_ENABLE_GAIN_MAP)
using GainMapPtr = std::unique_ptr<avifGainMap, UniquePtrDeleter>;
#endif

Expand Down
8 changes: 4 additions & 4 deletions include/avif/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading

0 comments on commit 5b5d365

Please sign in to comment.