Skip to content

Commit

Permalink
Updates after feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
kmilos committed Oct 24, 2022
1 parent 48c40ed commit 1e20064
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/imageio/format/jxl.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
#include "control/conf.h"
#include "imageio/format/imageio_format_api.h"

#include "jxl/encode.h"
#include "jxl/resizable_parallel_runner.h"
#include <jxl/encode.h>
#include <jxl/resizable_parallel_runner.h>

DT_MODULE(1)

Expand Down Expand Up @@ -493,7 +493,7 @@ static void bpp_changed(GtkWidget *widget, dt_imageio_jxl_gui_data_t *gui)

const int pixel_type = bpp_enum == 3 ? dt_bauhaus_combobox_get(gui->pixel_type) : bpp_enum == 4 ? 1 : 0;
const int quality = (int)dt_bauhaus_slider_get(gui->quality);
gboolean lossless = bpp_enum <= 3 && !pixel_type && quality == 100;
const gboolean lossless = bpp_enum <= 3 && !pixel_type && quality == 100;

gtk_widget_set_visible(gui->pixel_type, bpp_enum == 3);
gtk_widget_set_visible(gui->original, !lossless);
Expand All @@ -506,7 +506,7 @@ static void pixel_type_changed(GtkWidget *widget, dt_imageio_jxl_gui_data_t *gui

const int bpp_enum = dt_bauhaus_combobox_get(gui->bpp);
const int quality = (int)dt_bauhaus_slider_get(gui->quality);
gboolean lossless = bpp_enum <= 3 && !pixel_type && quality == 100;
const gboolean lossless = bpp_enum <= 3 && !pixel_type && quality == 100;
gtk_widget_set_visible(gui->original, !lossless);
}

Expand All @@ -517,7 +517,7 @@ static void quality_changed(GtkWidget *widget, dt_imageio_jxl_gui_data_t *gui)

const int bpp_enum = dt_bauhaus_combobox_get(gui->bpp);
const int pixel_type = bpp_enum == 3 ? dt_bauhaus_combobox_get(gui->pixel_type) : bpp_enum == 4 ? 1 : 0;
gboolean lossless = bpp_enum <= 3 && !pixel_type && quality == 100;
const gboolean lossless = bpp_enum <= 3 && !pixel_type && quality == 100;
gtk_widget_set_visible(gui->original, !lossless);
}

Expand Down Expand Up @@ -574,15 +574,19 @@ void gui_init(dt_imageio_module_format_t *self)
dt_bauhaus_slider_set(gui->quality, quality);
dt_bauhaus_widget_set_label(gui->quality, NULL, N_("quality"));
gtk_widget_set_tooltip_text(gui->quality, _("the quality of the output image\n0-29 = very lossy\n30-99 = JPEG "
"quality comparable\n100 = lossless (integer bith depth only)"));
"quality comparable\n100 = lossless (integer bit depth only)"));
g_signal_connect(G_OBJECT(gui->quality), "value-changed", G_CALLBACK(quality_changed), gui);
gtk_box_pack_start(GTK_BOX(box), gui->quality, TRUE, TRUE, 0);

// encoding color profile combobox
const int original = dt_conf_get_bool("plugins/imageio/format/jxl/original") & 1;

DT_BAUHAUS_COMBOBOX_NEW_FULL(gui->original, self, NULL, N_("encoding color profile"), NULL, original,
original_changed, NULL, N_("internal"), N_("original"));
DT_BAUHAUS_COMBOBOX_NEW_FULL(
gui->original, self, NULL, N_("encoding color profile"),
N_("the color profile used by the encoder\n"
"permit internal XYB color space conversion for more efficient lossy compression,\n"
"or ensure no conversion to keep original image color space (implied for lossless)"),
original, original_changed, NULL, N_("internal"), N_("original"));
dt_bauhaus_combobox_set_default(gui->original,
dt_confgen_get_bool("plugins/imageio/format/jxl/original", DT_DEFAULT) & 1);
gtk_box_pack_start(GTK_BOX(box), gui->original, TRUE, TRUE, 0);
Expand All @@ -598,7 +602,7 @@ void gui_init(dt_imageio_module_format_t *self)
dt_bauhaus_slider_set(gui->effort, dt_conf_get_int("plugins/imageio/format/jxl/effort"));
dt_bauhaus_widget_set_label(gui->effort, NULL, N_("encoding effort"));
gtk_widget_set_tooltip_text(gui->effort, _("the effort used to encode the image, higher efforts will have "
"better results at the expense of longer encode times"));
"better results at the expense of longer encoding times"));
g_signal_connect(G_OBJECT(gui->effort), "value-changed", G_CALLBACK(effort_changed), NULL);
gtk_box_pack_start(GTK_BOX(box), gui->effort, TRUE, TRUE, 0);

Expand Down

0 comments on commit 1e20064

Please sign in to comment.