From: Jehan Date: Fri, 17 Feb 2023 22:27:32 +0000 (+0100) Subject: babl: limit LUT creation for 4→8 and 4→16 bpp further. X-Git-Tag: archive/raspbian/1%0.1.106-3+rpi1^2~15^2^2~22 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e58957d92b61a0f3b6aee9b6ae94faaa95cc1b73;p=babl.git babl: limit LUT creation for 4→8 and 4→16 bpp further. 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. --- 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