From 7dda3bd1ed923e9c2dba887670b9f65509235375 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Thu, 8 Jun 2023 12:16:17 +0200 Subject: 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. --- fiv-io.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/fiv-io.c b/fiv-io.c index 8f27b0b..9b55030 100644 --- a/fiv-io.c +++ b/fiv-io.c @@ -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; -- cgit v1.2.3-70-g09d2