Skip to content

Commit

Permalink
Merge gainmap.h with avif.h (#1603)
Browse files Browse the repository at this point in the history
  • Loading branch information
maryla-uc authored Sep 21, 2023
1 parent e5b042a commit ddc7823
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 51 deletions.
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -790,9 +790,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
21 changes: 21 additions & 0 deletions include/avif/avif.h
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,27 @@ typedef struct avifGainMap
// For an image grid, the metadata shall be identical for all cells.
avifGainMapMetadata metadata;
} avifGainMap;

// Same as avifGainMapMetadata, but with fields of type double instead of uint32_t fractions.
// Use avifGainMapMetadataDoubleToFractions() to convert this to a avifGainMapMetadata.
// See avifGainMapMetadata 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

// ---------------------------------------------------------------------------
Expand Down
44 changes: 0 additions & 44 deletions include/avif/gainmap.h

This file was deleted.

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

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

#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP)
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

0 comments on commit ddc7823

Please sign in to comment.