[gimp] Updated HEIF plug-in



commit 76810d28ddeb748e77bc722c0fdf3d10111dc523
Author: Daniel Novomesky <dnovomesky gmail com>
Date:   Wed Dec 16 17:36:52 2020 +0100

    Updated HEIF plug-in
    
    Realtime parameter is set for AOM encoder
    when Fast encoding speed is selected by user.
    Ability to set pixel format (YUV444, RGB)
    is enabled for >= libheif 1.10
    to avoid issues in older versions.

 plug-ins/common/file-heif.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/plug-ins/common/file-heif.c b/plug-ins/common/file-heif.c
index 371576674d..16f16c4742 100644
--- a/plug-ins/common/file-heif.c
+++ b/plug-ins/common/file-heif.c
@@ -1427,7 +1427,7 @@ save_image (GFile                        *file,
   gint                      quality;
   gboolean                  save_profile;
   gint                      save_bit_depth = 8;
-#if LIBHEIF_HAVE_VERSION(1,9,0)
+#if LIBHEIF_HAVE_VERSION(1,10,0)
   HeifpluginExportFormat    pixel_format = HEIFPLUGIN_EXPORT_FORMAT_YUV420;
 #endif
 #if LIBHEIF_HAVE_VERSION(1,8,0)
@@ -1451,7 +1451,7 @@ save_image (GFile                        *file,
   g_object_get (config,
                 "lossless",           &lossless,
                 "quality",            &quality,
-#if LIBHEIF_HAVE_VERSION(1,9,0)
+#if LIBHEIF_HAVE_VERSION(1,10,0)
                 "pixel-format",       &pixel_format,
 #endif
 #if LIBHEIF_HAVE_VERSION(1,8,0)
@@ -1555,8 +1555,8 @@ save_image (GFile                        *file,
             }
         }
 
-#if LIBHEIF_HAVE_VERSION(1,9,0)
-      if (pixel_format == HEIFPLUGIN_EXPORT_FORMAT_RGB && save_bit_depth == 8)
+#if LIBHEIF_HAVE_VERSION(1,10,0)
+      if (pixel_format == HEIFPLUGIN_EXPORT_FORMAT_RGB)
         {
           nclx_profile.version = 1;
           nclx_profile.color_primaries = heif_color_primaries_unspecified;
@@ -1603,8 +1603,8 @@ save_image (GFile                        *file,
       nclx_profile.matrix_coefficients = heif_matrix_coefficients_ITU_R_BT_601_6;
       nclx_profile.full_range_flag = 1;
 
-#if LIBHEIF_HAVE_VERSION(1,9,0)
-      if (pixel_format == HEIFPLUGIN_EXPORT_FORMAT_RGB && save_bit_depth == 8)
+#if LIBHEIF_HAVE_VERSION(1,10,0)
+      if (pixel_format == HEIFPLUGIN_EXPORT_FORMAT_RGB)
         {
           nclx_profile.matrix_coefficients = heif_matrix_coefficients_RGB_GBR;
         }
@@ -1770,7 +1770,7 @@ save_image (GFile                        *file,
 
 #if LIBHEIF_HAVE_VERSION(1,8,0)
   encoder_name = heif_encoder_get_name (encoder);
-#if LIBHEIF_HAVE_VERSION(1,9,0)
+#if LIBHEIF_HAVE_VERSION(1,10,0)
 
   if (lossless && pixel_format != HEIFPLUGIN_EXPORT_FORMAT_RGB)
     {
@@ -1845,9 +1845,16 @@ save_image (GFile                        *file,
               break;
             case HEIFPLUGIN_ENCODER_SPEED_FASTER:
               parameter_number = 6;
+#if LIBHEIF_HAVE_VERSION(1,10,0)
+              err = heif_encoder_set_parameter_boolean (encoder, "realtime", 1);
+              if (err.code != 0)
+                {
+                  g_printerr ("Failed to set realtime=1 for %s encoder: %s",  encoder_name, err.message);
+                }
+#endif
               break;
             default: /*  HEIFPLUGIN_ENCODER_SPEED_BALANCED */
-              parameter_number = 4;
+              parameter_number = 5;
               break;
             }
 
@@ -2527,7 +2534,7 @@ save_dialog (GimpProcedure *procedure,
                             _("_Quality"),
                             0.0, 0.5, scale, 2);
 
-#if LIBHEIF_HAVE_VERSION(1,9,0)
+#if LIBHEIF_HAVE_VERSION(1,10,0)
   store = gimp_int_store_new (_("RGB"), HEIFPLUGIN_EXPORT_FORMAT_RGB,
                               _("YUV444"), HEIFPLUGIN_EXPORT_FORMAT_YUV444,
                               _("YUV420"), HEIFPLUGIN_EXPORT_FORMAT_YUV420,


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