From e58957d92b61a0f3b6aee9b6ae94faaa95cc1b73 Mon Sep 17 00:00:00 2001 From: Jehan Date: Fri, 17 Feb 2023 23:27:32 +0100 Subject: [PATCH] =?utf8?q?babl:=20limit=20LUT=20creation=20for=204?= =?utf8?q?=E2=86=928=20and=204=E2=86=9216=20bpp=20further.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Looking at LUT conversion code, we are clearly only supporting converting from "u8" (to "u16" or "float" respectively). Conversions such as "YA half" to "R'G'B'A float" for instance would be completely broken (it was trying to use only one byte of the "YA half", assumed it was "u8" and transform it to "float"). This is why the sample image in #85 was appearing on display as more transparent than it should when converted to 16-bit floating point grayscale image. --- babl/babl-fish-path.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/babl/babl-fish-path.c b/babl/babl-fish-path.c index 15bf65f..2cfb507 100644 --- a/babl/babl-fish-path.c +++ b/babl/babl-fish-path.c @@ -969,9 +969,10 @@ _babl_fish_prepare_bpp (Babl *babl) && ( ( source_bpp == 2 && dest_bpp == 16) - ||( source_bpp == 4 - && dest_bpp == 16 - && dest_type == babl_type_from_id (BABL_FLOAT) + ||( source_bpp == 4 + && dest_bpp == 16 + && source_type == babl_type_from_id (BABL_U8) + && dest_type == babl_type_from_id (BABL_FLOAT) && dest_not_associated) ||( source_bpp == 4 @@ -979,9 +980,10 @@ _babl_fish_prepare_bpp (Babl *babl) && dest_type == source_type && dest_not_associated) - ||( source_bpp == 4 - && dest_bpp == 8 - && dest_type == babl_type_from_id (BABL_U16) + ||( source_bpp == 4 + && dest_bpp == 8 + && source_type == babl_type_from_id (BABL_U8) + && dest_type == babl_type_from_id (BABL_U16) && dest_not_associated) ||( source_bpp == 3 -- 2.30.2