Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/strukturag/libheif into t…
Browse files Browse the repository at this point in the history
…imestamp_boxes
  • Loading branch information
dukesook committed Nov 2, 2023
2 parents d23cca4 + e29fcc7 commit 3d09f49
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion examples/heif_convert.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ void list_all_decoders()
std::cout << "JPEG decoders:\n";
list_decoders(heif_compression_JPEG);

std::cout << "JPEG-2000 decoders:\n";
std::cout << "JPEG 2000 decoders:\n";
list_decoders(heif_compression_JPEG2000);

#if WITH_UNCOMPRESSED_CODEC
Expand Down
6 changes: 3 additions & 3 deletions examples/heif_enc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ void show_help(const char* argv0)
<< " -p set encoder parameter (NAME=VALUE)\n"
<< " -A, --avif encode as AVIF (not needed if output filename with .avif suffix is provided)\n"
<< " --jpeg encode as JPEG\n"
<< " --jpeg2000 encode as JPEG-2000 (experimental)\n"
<< " --jpeg2000 encode as JPEG 2000 (experimental)\n"
#if WITH_UNCOMPRESSED_CODEC
<< " -U, --uncompressed encode as uncompressed image (according to ISO 23001-17) (EXPERIMENTAL)\n"
#endif
Expand Down Expand Up @@ -362,7 +362,7 @@ static const char* get_compression_format_name(heif_compression_format format)
return "JPEG";
break;
case heif_compression_JPEG2000:
return "JPEG-2000";
return "JPEG 2000";
break;
case heif_compression_uncompressed:
return "Uncompressed";
Expand Down Expand Up @@ -392,7 +392,7 @@ static void show_list_of_all_encoders()
std::cout << "JPEG";
break;
case heif_compression_JPEG2000:
std::cout << "JPEG-2000";
std::cout << "JPEG 2000";
break;
case heif_compression_uncompressed:
std::cout << "Uncompressed";
Expand Down
2 changes: 1 addition & 1 deletion libheif/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,7 @@ Error HeifContext::Image::get_preferred_decoding_colorspace(heif_colorspace* out
return err;
}

// TODO: this should be codec specific. JPEG-2000, for example, can use RGB internally.
// TODO: this should be codec specific. JPEG 2000, for example, can use RGB internally.

*out_colorspace = heif_colorspace_YCbCr;
*out_chroma = heif_chroma_undefined;
Expand Down
11 changes: 3 additions & 8 deletions libheif/heif.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,24 +83,19 @@ uint32_t heif_get_version_number(void)
return (LIBHEIF_NUMERIC_VERSION);
}

static uint8_t bcd2dec(uint8_t v)
{
return uint8_t((v >> 4) * 10 + (v & 0x0F));
}

int heif_get_version_number_major(void)
{
return bcd2dec(((LIBHEIF_NUMERIC_VERSION) >> 24) & 0xFF);
return ((LIBHEIF_NUMERIC_VERSION) >> 24) & 0xFF;
}

int heif_get_version_number_minor(void)
{
return bcd2dec(((LIBHEIF_NUMERIC_VERSION) >> 16) & 0xFF);
return ((LIBHEIF_NUMERIC_VERSION) >> 16) & 0xFF;
}

int heif_get_version_number_maintenance(void)
{
return bcd2dec(((LIBHEIF_NUMERIC_VERSION) >> 8) & 0xFF);
return ((LIBHEIF_NUMERIC_VERSION) >> 8) & 0xFF;
}


Expand Down
11 changes: 5 additions & 6 deletions libheif/heif.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,18 @@ extern "C" {
// Version string of linked libheif library.
LIBHEIF_API const char* heif_get_version(void);

// Numeric version of linked libheif library, encoded as BCD 0xHHMMLL00 = HH.MM.LL.
// For example: 0x02143000 is version 2.14.30
// Numeric version of linked libheif library, encoded as 0xHHMMLL00 = hh.mm.ll, where hh, mm, ll is the decimal representation of HH, MM, LL.
// For example: 0x02150300 is version 2.21.3
LIBHEIF_API uint32_t heif_get_version_number(void);

// Numeric part "HH" from above. Returned as a decimal number (not BCD).
// Numeric part "HH" from above. Returned as a decimal number.
LIBHEIF_API int heif_get_version_number_major(void);
// Numeric part "MM" from above. Returned as a decimal number (not BCD).
// Numeric part "MM" from above. Returned as a decimal number.
LIBHEIF_API int heif_get_version_number_minor(void);
// Numeric part "LL" from above. Returned as a decimal number (not BCD).
// Numeric part "LL" from above. Returned as a decimal number.
LIBHEIF_API int heif_get_version_number_maintenance(void);

// Helper macros to check for given versions of libheif at compile time.
// Note: h, m, l should be 2-digit BCD numbers. I.e., decimal 17 = 0x17 (BCD)
#define LIBHEIF_MAKE_VERSION(h, m, l) ((h) << 24 | (m) << 16 | (l) << 8)
#define LIBHEIF_HAVE_VERSION(h, m, l) (LIBHEIF_NUMERIC_VERSION >= LIBHEIF_MAKE_VERSION(h, m, l))

Expand Down

0 comments on commit 3d09f49

Please sign in to comment.