Make it possible to switch off our TIFF/EP loader

Slightly repurpose the "enhance" toggle, which doesn't particularly
make sense to run on a thumbnail.
This commit is contained in:
Přemysl Eric Janouch 2023-06-08 12:16:17 +02:00
parent a3a5eb33cf
commit 7dda3bd1ed
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 13 additions and 6 deletions

View File

@ -1880,13 +1880,16 @@ fail:
// typically contain a nearly full-size JPEG preview.
//
// LibRaw takes too long a time to render something that will never be as good
// as the large preview, and libtiff can only read the horrible IFD0 thumbnail.
// as that large preview--e.g., due to exposure correction or denoising.
// While since version 0.21.0 the library provides an API that would allow us
// to extract the JPEG, a little bit of custom processing won't hurt either.
// TODO(p): Though it can also extract thumbnails from many more formats,
// so maybe keep this code as a fallback for old or missing LibRaw.
//
// Note that libtiff can only read the horrible IFD0 thumbnail.
// (TIFFSetSubDirectory() requires an ImageLength tag that's missing from JPEG
// SubIFDs, and TIFFReadCustomDirectory() takes a privately defined struct that
// may not be omitted.)
//
// While LibRaw since 0.21.0 provides an API that would allow us to extract
// the JPEG, a little bit of custom processing won't hurt either.
static bool
tiffer_find(const struct tiffer *self, uint16_t tag, struct tiffer_entry *entry)
@ -3234,15 +3237,19 @@ fiv_io_open_from_data(
surface = open_libwebp(data, len, ctx, error);
break;
default:
// Try to extract full-size previews from TIFF/EP-compatible raws.
// Try to extract full-size previews from TIFF/EP-compatible raws,
// but allow for running the full render.
#ifdef HAVE_LIBRAW // ---------------------------------------------------------
if (!ctx->enhance) {
#endif // HAVE_LIBRAW ---------------------------------------------------------
if ((surface = open_tiff_ep(data, len, ctx, error)))
break;
if (error) {
g_debug("%s", (*error)->message);
g_clear_error(error);
}
#ifdef HAVE_LIBRAW // ---------------------------------------------------------
}
if ((surface = open_libraw(data, len, ctx, error)))
break;