Skip to content

Commit

Permalink
update libavif to v1.1.1, libheif to v1.18.2
Browse files Browse the repository at this point in the history
  • Loading branch information
qbnu committed Aug 9, 2024
1 parent 8e21fa8 commit bc6d038
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 40 deletions.
Binary file modified src/JPEGView/libavif/bin/avif.dll
Binary file not shown.
Binary file modified src/JPEGView/libavif/bin/dav1d.dll
Binary file not shown.
Binary file modified src/JPEGView/libavif/bin64/avif.dll
Binary file not shown.
Binary file modified src/JPEGView/libavif/bin64/dav1d.dll
Binary file not shown.
41 changes: 15 additions & 26 deletions src/JPEGView/libavif/include/avif/avif.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@
extern "C" {
#endif

// Define the internal macro AVIF_USE_NODISCARD if AVIF_NODISCARD will be defined as [[nodiscard]].
// In this case, also use the standard [[...]] attribute syntax for GCC's visibility("default")
// attribute to avoid compilation errors.
#if defined(AVIF_ENABLE_NODISCARD) || (defined(__cplusplus) && __cplusplus >= 201703L) || \
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L)
#define AVIF_USE_NODISCARD 1
#endif

// ---------------------------------------------------------------------------
// Export macros

Expand All @@ -39,11 +31,7 @@ extern "C" {
#define AVIF_HELPER_EXPORT __declspec(dllexport)
#define AVIF_HELPER_IMPORT __declspec(dllimport)
#elif defined(__GNUC__) && __GNUC__ >= 4
#if defined(AVIF_USE_NODISCARD)
#define AVIF_HELPER_EXPORT [[gnu::visibility("default")]]
#else
#define AVIF_HELPER_EXPORT __attribute__((visibility("default")))
#endif
#define AVIF_HELPER_IMPORT
#else
#define AVIF_HELPER_EXPORT
Expand All @@ -60,7 +48,8 @@ extern "C" {
#define AVIF_API
#endif // defined(AVIF_DLL)

#if defined(AVIF_USE_NODISCARD)
#if defined(AVIF_ENABLE_NODISCARD) || (defined(__cplusplus) && __cplusplus >= 201703L) || \
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L)
#define AVIF_NODISCARD [[nodiscard]]
#else
// Starting with 3.9, clang allows defining the warn_unused_result attribute for enums.
Expand All @@ -84,7 +73,7 @@ extern "C" {
// to leverage in-development code without breaking their stable builds.
#define AVIF_VERSION_MAJOR 1
#define AVIF_VERSION_MINOR 1
#define AVIF_VERSION_PATCH 0
#define AVIF_VERSION_PATCH 1
#define AVIF_VERSION_DEVEL 0
#define AVIF_VERSION \
((AVIF_VERSION_MAJOR * 1000000) + (AVIF_VERSION_MINOR * 10000) + (AVIF_VERSION_PATCH * 100) + AVIF_VERSION_DEVEL)
Expand Down Expand Up @@ -521,13 +510,13 @@ typedef struct avifCropRect

// These will return AVIF_FALSE if the resultant values violate any standards, and if so, the output
// values are not guaranteed to be complete or correct and should not be used.
AVIF_API AVIF_NODISCARD avifBool avifCropRectConvertCleanApertureBox(avifCropRect * cropRect,
AVIF_NODISCARD AVIF_API avifBool avifCropRectConvertCleanApertureBox(avifCropRect * cropRect,
const avifCleanApertureBox * clap,
uint32_t imageW,
uint32_t imageH,
avifPixelFormat yuvFormat,
avifDiagnostics * diag);
AVIF_API AVIF_NODISCARD avifBool avifCleanApertureBoxConvertCropRect(avifCleanApertureBox * clap,
AVIF_NODISCARD AVIF_API avifBool avifCleanApertureBoxConvertCropRect(avifCleanApertureBox * clap,
const avifCropRect * cropRect,
uint32_t imageW,
uint32_t imageH,
Expand Down Expand Up @@ -694,7 +683,7 @@ typedef struct avifGainMap

// Allocates a gain map. Returns NULL if a memory allocation failed.
// The 'image' field is NULL by default and must be allocated separately.
AVIF_API avifGainMap * avifGainMapCreate();
AVIF_API avifGainMap * avifGainMapCreate(void);
// Frees a gain map, including the 'image' field if non NULL.
AVIF_API void avifGainMapDestroy(avifGainMap * gainMap);

Expand All @@ -716,10 +705,10 @@ typedef struct 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 AVIF_NODISCARD avifBool avifGainMapMetadataDoubleToFractions(avifGainMapMetadata * dst, const avifGainMapMetadataDouble * src);
AVIF_NODISCARD AVIF_API avifBool avifGainMapMetadataDoubleToFractions(avifGainMapMetadata * dst, const avifGainMapMetadataDouble * src);
// Converts a avifGainMapMetadata to avifGainMapMetadataDouble by converting fractions to double values.
// Returns AVIF_FALSE if some denominators are zero.
AVIF_API AVIF_NODISCARD avifBool avifGainMapMetadataFractionsToDouble(avifGainMapMetadataDouble * dst, const avifGainMapMetadata * src);
AVIF_NODISCARD AVIF_API avifBool avifGainMapMetadataFractionsToDouble(avifGainMapMetadataDouble * dst, const avifGainMapMetadata * src);

#endif // AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP

Expand Down Expand Up @@ -830,8 +819,8 @@ typedef struct avifImage
} avifImage;

// avifImageCreate() and avifImageCreateEmpty() return NULL if arguments are invalid or if a memory allocation failed.
AVIF_API AVIF_NODISCARD avifImage * avifImageCreate(uint32_t width, uint32_t height, uint32_t depth, avifPixelFormat yuvFormat);
AVIF_API AVIF_NODISCARD avifImage * avifImageCreateEmpty(void); // helper for making an image to decode into
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.
AVIF_API avifResult avifImageCopy(avifImage * dstImage, const avifImage * srcImage, avifPlanesFlags planes);
Expand Down Expand Up @@ -1377,7 +1366,7 @@ AVIF_API avifResult avifDecoderReset(avifDecoder * decoder);
// frameIndex - 0-based, matching avifDecoder->imageIndex, bound by avifDecoder->imageCount
// "nearest" keyframe means the keyframe prior to this frame index (returns frameIndex if it is a keyframe)
// These functions may be used after a successful call (AVIF_RESULT_OK) to avifDecoderParse().
AVIF_API AVIF_NODISCARD avifBool avifDecoderIsKeyframe(const avifDecoder * decoder, uint32_t frameIndex);
AVIF_NODISCARD AVIF_API avifBool avifDecoderIsKeyframe(const avifDecoder * decoder, uint32_t frameIndex);
AVIF_API uint32_t avifDecoderNearestKeyframe(const avifDecoder * decoder, uint32_t frameIndex);

// Timing helper - This does not change the current image or invoke the codec (safe to call repeatedly)
Expand Down Expand Up @@ -1521,7 +1510,7 @@ typedef struct avifEncoder
} avifEncoder;

// avifEncoderCreate() returns NULL if a memory allocation failed.
AVIF_API AVIF_NODISCARD avifEncoder * avifEncoderCreate(void);
AVIF_NODISCARD AVIF_API avifEncoder * avifEncoderCreate(void);
AVIF_API avifResult avifEncoderWrite(avifEncoder * encoder, const avifImage * image, avifRWData * output);
AVIF_API void avifEncoderDestroy(avifEncoder * encoder);

Expand Down Expand Up @@ -1586,8 +1575,8 @@ AVIF_API size_t avifEncoderGetGainMapSizeBytes(avifEncoder * encoder);
#endif

// Helpers
AVIF_API AVIF_NODISCARD avifBool avifImageUsesU16(const avifImage * image);
AVIF_API AVIF_NODISCARD avifBool avifImageIsOpaque(const avifImage * image);
AVIF_NODISCARD AVIF_API avifBool avifImageUsesU16(const avifImage * image);
AVIF_NODISCARD AVIF_API avifBool avifImageIsOpaque(const avifImage * image);
// channel can be an avifChannelIndex.
AVIF_API uint8_t * avifImagePlane(const avifImage * image, int channel);
AVIF_API uint32_t avifImagePlaneRowBytes(const avifImage * image, int channel);
Expand All @@ -1596,7 +1585,7 @@ AVIF_API uint32_t avifImagePlaneHeight(const avifImage * image, int channel);

// Returns AVIF_TRUE if input begins with a valid FileTypeBox (ftyp) that supports
// either the brand 'avif' or 'avis' (or both), without performing any allocations.
AVIF_API AVIF_NODISCARD avifBool avifPeekCompatibleFileType(const avifROData * input);
AVIF_NODISCARD AVIF_API avifBool avifPeekCompatibleFileType(const avifROData * input);

#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP)
// ---------------------------------------------------------------------------
Expand Down
24 changes: 12 additions & 12 deletions src/JPEGView/libavif/include/avif/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -558,19 +558,19 @@ struct avifCodecInternal;

typedef enum avifEncoderChange
{
AVIF_ENCODER_CHANGE_MIN_QUANTIZER = (1u << 0),
AVIF_ENCODER_CHANGE_MAX_QUANTIZER = (1u << 1),
AVIF_ENCODER_CHANGE_MIN_QUANTIZER_ALPHA = (1u << 2),
AVIF_ENCODER_CHANGE_MAX_QUANTIZER_ALPHA = (1u << 3),
AVIF_ENCODER_CHANGE_TILE_ROWS_LOG2 = (1u << 4),
AVIF_ENCODER_CHANGE_TILE_COLS_LOG2 = (1u << 5),
AVIF_ENCODER_CHANGE_QUANTIZER = (1u << 6),
AVIF_ENCODER_CHANGE_QUANTIZER_ALPHA = (1u << 7),
AVIF_ENCODER_CHANGE_SCALING_MODE = (1u << 8),

AVIF_ENCODER_CHANGE_CODEC_SPECIFIC = (1u << 31)
AVIF_ENCODER_CHANGE_MIN_QUANTIZER = (1 << 0),
AVIF_ENCODER_CHANGE_MAX_QUANTIZER = (1 << 1),
AVIF_ENCODER_CHANGE_MIN_QUANTIZER_ALPHA = (1 << 2),
AVIF_ENCODER_CHANGE_MAX_QUANTIZER_ALPHA = (1 << 3),
AVIF_ENCODER_CHANGE_TILE_ROWS_LOG2 = (1 << 4),
AVIF_ENCODER_CHANGE_TILE_COLS_LOG2 = (1 << 5),
AVIF_ENCODER_CHANGE_QUANTIZER = (1 << 6),
AVIF_ENCODER_CHANGE_QUANTIZER_ALPHA = (1 << 7),
AVIF_ENCODER_CHANGE_SCALING_MODE = (1 << 8),

AVIF_ENCODER_CHANGE_CODEC_SPECIFIC = (1 << 30)
} avifEncoderChange;
typedef uint32_t avifEncoderChanges;
typedef int avifEncoderChanges;

typedef avifBool (*avifCodecGetNextImageFunc)(struct avifCodec * codec,
struct avifDecoder * decoder,
Expand Down
Binary file modified src/JPEGView/libheif/bin/heif.dll
Binary file not shown.
Binary file modified src/JPEGView/libheif/bin/libde265.dll
Binary file not shown.
Binary file modified src/JPEGView/libheif/bin64/heif.dll
Binary file not shown.
Binary file modified src/JPEGView/libheif/bin64/libde265.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions src/JPEGView/libheif/include/libheif/heif_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
#define LIBHEIF_HEIF_VERSION_H

/* Numeric representation of the version */
#define LIBHEIF_NUMERIC_VERSION ((1<<24) | (18<<16) | (0<<8) | 0)
#define LIBHEIF_NUMERIC_VERSION ((1<<24) | (18<<16) | (2<<8) | 0)

/* Version string */
#define LIBHEIF_VERSION "1.18.0"
#define LIBHEIF_VERSION "1.18.2"

#define LIBHEIF_PLUGIN_DIRECTORY "C:/Program Files/libheif/lib/libheif"

Expand Down
Binary file modified src/JPEGView/libheif/lib/heif.lib
Binary file not shown.
Binary file modified src/JPEGView/libheif/lib64/heif.lib
Binary file not shown.

0 comments on commit bc6d038

Please sign in to comment.