[gimp/gimp-2-10] HEIF plug-in: ensure max quality for lossless encoding



commit 51d8421eaa11cd1d087a66980061d013c3a543af
Author: Daniel Novomesky <dnovomesky gmail com>
Date:   Tue Jan 12 12:22:30 2021 +0100

    HEIF plug-in: ensure max quality for lossless encoding
    
    There is a possible bug in libheif. Lossless setting is not working
    when AVIF is saved via rav1e encoder.
    This is a workaround of the problem.

 plug-ins/common/file-heif.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/plug-ins/common/file-heif.c b/plug-ins/common/file-heif.c
index 43a7650f67..907e7c9c03 100644
--- a/plug-ins/common/file-heif.c
+++ b/plug-ins/common/file-heif.c
@@ -1536,7 +1536,17 @@ save_image (GFile                        *file,
       return FALSE;
     }
 
-  heif_encoder_set_lossy_quality (encoder, params->quality);
+  /* workaround for a bug in libheif when heif_encoder_set_lossless is not working
+     (known problem with encoding via rav1e) */
+  if (params->lossless)
+    {
+      heif_encoder_set_lossy_quality (encoder, 100);
+    }
+  else
+    {
+      heif_encoder_set_lossy_quality (encoder, params->quality);
+    }
+
   heif_encoder_set_lossless (encoder, params->lossless);
   /* heif_encoder_set_logging_level (encoder, logging_level); */
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]