Merge pull request #1679 from lovell/heifload-fixes-nclx-hdr
heifload: ignore nclx colour profiles, ensure assumed uchar format
This commit is contained in:
commit
f2688ee6c1
12
configure.ac
12
configure.ac
|
@ -940,6 +940,18 @@ if test x"$with_heif" = x"yes"; then
|
||||||
LIBS="$save_LIBS"
|
LIBS="$save_LIBS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# heif_decoding_options.convert_hdr_to_8bit added in 1.7.0
|
||||||
|
if test x"$with_heif" = x"yes"; then
|
||||||
|
save_CFLAGS="$CFLAGS"
|
||||||
|
CFLAGS="$CFLAGS $HEIF_CFLAGS"
|
||||||
|
AC_CHECK_MEMBER([struct heif_decoding_options.convert_hdr_to_8bit],[
|
||||||
|
AC_DEFINE(HAVE_HEIF_DECODING_OPTIONS_CONVERT_HDR_TO_8BIT,1,
|
||||||
|
[define if you have heif_decoding_options.convert_hdr_to_8bit])
|
||||||
|
],[],
|
||||||
|
[#include <libheif/heif.h>])
|
||||||
|
CFLAGS="$save_CFLAGS"
|
||||||
|
fi
|
||||||
|
|
||||||
# pdfium
|
# pdfium
|
||||||
AC_ARG_WITH([pdfium],
|
AC_ARG_WITH([pdfium],
|
||||||
AS_HELP_STRING([--without-pdfium], [build without pdfium (default: test)]))
|
AS_HELP_STRING([--without-pdfium], [build without pdfium (default: test)]))
|
||||||
|
|
|
@ -419,11 +419,11 @@ vips_foreign_load_heif_set_header( VipsForeignLoadHeif *heif, VipsImage *out )
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_HEIF_COLOR_PROFILE
|
#ifdef HAVE_HEIF_COLOR_PROFILE
|
||||||
#ifdef DEBUG
|
|
||||||
{
|
|
||||||
enum heif_color_profile_type profile_type =
|
enum heif_color_profile_type profile_type =
|
||||||
heif_image_handle_get_color_profile_type( heif->handle );
|
heif_image_handle_get_color_profile_type( heif->handle );
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
{
|
||||||
printf( "profile type = " );
|
printf( "profile type = " );
|
||||||
switch( profile_type ) {
|
switch( profile_type ) {
|
||||||
case heif_color_profile_type_not_present:
|
case heif_color_profile_type_not_present:
|
||||||
|
@ -450,10 +450,10 @@ vips_foreign_load_heif_set_header( VipsForeignLoadHeif *heif, VipsImage *out )
|
||||||
}
|
}
|
||||||
#endif /*DEBUG*/
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
/* FIXME should probably check the profile type ... lcms seems to be
|
/* lcms can load standard (prof) and reduced (rICC) profiles
|
||||||
* able to load at least rICC and prof.
|
|
||||||
*/
|
*/
|
||||||
if( heif_image_handle_get_color_profile_type( heif->handle ) ) {
|
if( profile_type == heif_color_profile_type_prof ||
|
||||||
|
profile_type == heif_color_profile_type_rICC ) {
|
||||||
size_t length = heif_image_handle_get_raw_color_profile_size(
|
size_t length = heif_image_handle_get_raw_color_profile_size(
|
||||||
heif->handle );
|
heif->handle );
|
||||||
|
|
||||||
|
@ -475,6 +475,9 @@ vips_foreign_load_heif_set_header( VipsForeignLoadHeif *heif, VipsImage *out )
|
||||||
vips_image_set_blob( out, VIPS_META_ICC_NAME,
|
vips_image_set_blob( out, VIPS_META_ICC_NAME,
|
||||||
(VipsCallbackFn) NULL, data, length );
|
(VipsCallbackFn) NULL, data, length );
|
||||||
}
|
}
|
||||||
|
else if( profile_type == heif_color_profile_type_nclx ) {
|
||||||
|
g_warning( "heifload: ignoring nclx profile" );
|
||||||
|
}
|
||||||
#endif /*HAVE_HEIF_COLOR_PROFILE*/
|
#endif /*HAVE_HEIF_COLOR_PROFILE*/
|
||||||
|
|
||||||
/* If we are using libheif's autorotate, remove the exif one.
|
/* If we are using libheif's autorotate, remove the exif one.
|
||||||
|
@ -717,6 +720,11 @@ vips_foreign_load_heif_generate( VipsRegion *or,
|
||||||
#ifdef HAVE_HEIF_IMAGE_HANDLE_GET_ISPE_WIDTH
|
#ifdef HAVE_HEIF_IMAGE_HANDLE_GET_ISPE_WIDTH
|
||||||
options->ignore_transformations = !heif->autorotate;
|
options->ignore_transformations = !heif->autorotate;
|
||||||
#endif /*HAVE_HEIF_IMAGE_HANDLE_GET_ISPE_WIDTH*/
|
#endif /*HAVE_HEIF_IMAGE_HANDLE_GET_ISPE_WIDTH*/
|
||||||
|
#ifdef HAVE_HEIF_DECODING_OPTIONS_CONVERT_HDR_TO_8BIT
|
||||||
|
/* VIPS_FORMAT_UCHAR is assumed so downsample HDR to 8bpc
|
||||||
|
*/
|
||||||
|
options->convert_hdr_to_8bit = TRUE;
|
||||||
|
#endif /*HAVE_HEIF_DECODING_OPTIONS_CONVERT_HDR_TO_8BIT*/
|
||||||
error = heif_decode_image( heif->handle, &heif->img,
|
error = heif_decode_image( heif->handle, &heif->img,
|
||||||
heif_colorspace_RGB, chroma,
|
heif_colorspace_RGB, chroma,
|
||||||
options );
|
options );
|
||||||
|
|
Loading…
Reference in New Issue