[babl] babl: add 4:8 luts
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] babl: add 4:8 luts
- Date: Thu, 27 Jan 2022 07:51:44 +0000 (UTC)
commit 7d46bcd1fb902d2cb5af92bf4a8fd4a59b562183
Author: Øyvind Kolås <pippin gimp org>
Date: Thu Jan 27 08:18:53 2022 +0100
babl: add 4:8 luts
babl/babl-fish-path.c | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
---
diff --git a/babl/babl-fish-path.c b/babl/babl-fish-path.c
index d1c754f6d..bf88ab633 100644
--- a/babl/babl-fish-path.c
+++ b/babl/babl-fish-path.c
@@ -139,6 +139,24 @@ static inline void _do_lut (uint32_t *lut,
dst++;
}
}
+ else if (source_bpp == 4 && dest_bpp == 8)
+ {
+ uint32_t *src = (uint32_t*)source;
+ uint16_t *dst = (uint16_t*)destination;
+ uint16_t *lut16 = (uint16_t*)lut;
+ while (n--)
+ {
+ uint32_t col = *src++;
+ uint32_t lut_offset = col & 0xffffff;
+ uint16_t alpha = (col>>24) << 8;
+
+ dst[0] = lut16[lut_offset*2+0];
+ dst[1] = lut16[lut_offset*2+1];
+ dst[2] = lut16[lut_offset*2+2];
+ dst[3] = alpha;
+ dst+=4;
+ }
+ }
else if (source_bpp == 2 && dest_bpp == 16)
{
uint16_t *src = (uint16_t*)source;
@@ -249,7 +267,7 @@ static inline float lut_timing_for (int source_bpp, int dest_bpp)
static void measure_timings(void)
{
int num_pixels = babl_get_num_path_test_pixels () * 1000;
- int pairs[][2]={{4,4},{3,4},{3,3},{2,4},{2,2},{1,4},{2,16},{4,16}};
+ int pairs[][2]={{4,4},{4,8},{3,4},{3,3},{2,4},{2,2},{1,4},{2,16},{4,16}};
uint32_t *lut = malloc (256 * 256 * 256 * 16);
uint32_t *src = malloc (num_pixels * 16);
uint32_t *dst = malloc (num_pixels * 16);
@@ -336,6 +354,18 @@ static inline int babl_fish_lut_process_maybe (const Babl *babl,
256*256*256);
free (temp_lut);
}
+ else if (source_bpp == 4 && dest_bpp == 8)
+ {
+ uint32_t *temp_lut = malloc (256 * 256 * 256 * 4);
+ lut = malloc (256 * 256 * 256 * 8);
+ for (int o = 0; o < 256 * 256 * 256; o++)
+ temp_lut[o] = o;
+ process_conversion_path (babl->fish_path.conversion_list,
+ temp_lut, 4,
+ lut, 8,
+ 256*256*256);
+ free (temp_lut);
+ }
else if (source_bpp == 3 && dest_bpp == 3)
{
uint8_t *temp_lut = malloc (256 * 256 * 256 * 3);
@@ -913,6 +943,7 @@ _babl_fish_prepare_bpp (Babl *babl)
(source_bpp == 2 && dest_bpp == 16)
||(source_bpp == 4 && dest_bpp == 16)
||(source_bpp == 4 && dest_bpp == 4)
+ ||(source_bpp == 4 && dest_bpp == 8)
||(source_bpp == 3 && dest_bpp == 4)
||(source_bpp == 2 && dest_bpp == 4)
||(source_bpp == 2 && dest_bpp == 2)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]