Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge gainmap.h with avif.h #1603

Merged
merged 2 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -783,9 +783,6 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
endif()
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL)
install(FILES include/avif/avif.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/avif")
if(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP)
install(FILES include/avif/gainmap.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/avif")
endif()
endif()

# ---------------------------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion apps/shared/avifjpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "iccjpeg.h"

#if defined(AVIF_ENABLE_EXPERIMENTAL_JPEG_GAIN_MAP_CONVERSION)
#include "avif/gainmap.h"
#include <libxml/parser.h>
#endif

Expand Down
30 changes: 30 additions & 0 deletions include/avif/avif.h
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,36 @@ AVIF_API uint32_t avifImagePlaneHeight(const avifImage * image, int channel);
// either the brand 'avif' or 'avis' (or both), without performing any allocations.
AVIF_API avifBool avifPeekCompatibleFileType(const avifROData * input);

#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP)
// ---------------------------------------------------------------------------
// Gain Map related utilities.
// Gain Maps are a HIGHLY EXPERIMENTAL FEATURE. The format might still change and
// images containing a gain map encoded with the current version of libavif might
// not decode with a future version of libavif. The API is not guaranteed
// to be stable, and might even be removed in the future. Use are your own risk.

// Same as avifGainMapMetadata, but with fields of type double instead of uint32_t fractions.
// Use avifGainMapMetadataDoubleToFractions() to convert this to a avifGainMapMetadata.
// See avifGainMapMetadata in avif.h for detailed descriptions of fields.
typedef struct avifGainMapMetadataDouble
{
double gainMapMin[3];
double gainMapMax[3];
double gainMapGamma[3];
double offsetSdr[3];
double offsetHdr[3];
double hdrCapacityMin;
double hdrCapacityMax;
avifBool baseRenditionIsHDR;
} avifGainMapMetadataDouble;

// Converts a avifGainMapMetadataDouble to avifGainMapMetadata by converting double values
// to the closest uint32_t fractions.
// Returns AVIF_FALSE if some field values are < 0 or > UINT32_MAX.
AVIF_API avifBool avifGainMapMetadataDoubleToFractions(avifGainMapMetadata * dst, const avifGainMapMetadataDouble * src);

#endif // AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP

#ifdef __cplusplus
} // extern "C"
#endif
Expand Down
44 changes: 0 additions & 44 deletions include/avif/gainmap.h

This file was deleted.

1 change: 0 additions & 1 deletion src/gainmap.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2023 Google LLC
// SPDX-License-Identifier: BSD-2-Clause

#include "avif/gainmap.h"
#include "avif/avif.h"
#include "avif/internal.h"

Expand Down
1 change: 0 additions & 1 deletion tests/gtest/avifgainmaptest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <fstream>

#include "avif/avif.h"
#include "avif/gainmap.h"
#include "avif/internal.h"
#include "avifincrtest_helpers.h"
#include "aviftest_helpers.h"
Expand Down