[babl] babl: remove some now dead u8 code
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] babl: remove some now dead u8 code
- Date: Sun, 23 Jan 2022 11:59:51 +0000 (UTC)
commit 3641a255283f5a0957c6661c3e1ee0a4faba703e
Author: Øyvind Kolås <pippin gimp org>
Date: Sun Jan 23 12:08:14 2022 +0100
babl: remove some now dead u8 code
babl/base/babl-rgb-converter.c | 111 -----------------------------------------
babl/base/babl-trc.c | 5 --
babl/base/babl-trc.h | 95 -----------------------------------
3 files changed, 211 deletions(-)
---
diff --git a/babl/base/babl-rgb-converter.c b/babl/base/babl-rgb-converter.c
index be0159a..3f4da04 100644
--- a/babl/base/babl-rgb-converter.c
+++ b/babl/base/babl-rgb-converter.c
@@ -58,24 +58,6 @@ prep_conversion (const Babl *babl)
} \
}while(0)
-#define TRC_IN_u8(rgba_in, rgba_out) do{ \
- if ((source_space->space.trc[0] == source_space->space.trc[1]) && \
- (source_space->space.trc[1] == source_space->space.trc[2])) \
- { \
- const Babl *trc = (void*)source_space->space.trc[0]; \
- _babl_trc_to_linear_buf_u8_generic(trc, rgba_in, rgba_out, 4, 4, 3, samples); \
- } \
- else \
- { \
- unsigned int c; \
- for (c = 0; c < 3; c ++) \
- { \
- const Babl *trc = (void*)source_space->space.trc[c]; \
- _babl_trc_to_linear_buf_u8_generic (trc, rgba_in + c, rgba_out + c, 4, 4, 1, samples); \
- } \
- } \
-}while(0)
-
#define TRC_OUT(rgba_in, rgba_out) do{\
{ \
if ((destination_space->space.trc[0] == destination_space->space.trc[1]) && \
@@ -97,28 +79,6 @@ prep_conversion (const Babl *babl)
} while(0)
-#define TRC_OUT_u8(rgba_in, rgba_out) do{\
- { \
- if ((destination_space->space.trc[0] == destination_space->space.trc[1]) && \
- (destination_space->space.trc[1] == destination_space->space.trc[2])) \
- { \
- const Babl *trc = (void*)destination_space->space.trc[0]; \
- _babl_trc_from_linear_buf_u8_generic(trc, rgba_in, rgba_out, 4, 4, 3, samples); \
- } \
- else \
- { \
- unsigned int c; \
- for (c = 0; c < 3; c ++) \
- { \
- const Babl *trc = (void*)destination_space->space.trc[c]; \
- _babl_trc_from_linear_buf_u8_generic(trc, rgba_in + c, rgba_out + c, 4, 4, 1, samples); \
- } \
- } \
- }\
-} while(0)
-
-
-
static inline void
universal_nonlinear_rgba_converter (const Babl *conversion,
unsigned char *__restrict__ src_char,
@@ -174,29 +134,6 @@ universal_linear_rgb_nonlinear_converter (const Babl *conversion,
TRC_OUT(rgba_out, rgba_out);
}
-static inline void
-universal_nonlinear_rgba_u8_converter (const Babl *conversion,
- unsigned char *__restrict__ src_char,
- unsigned char *__restrict__ dst_char,
- long samples,
- void *data)
-{
- const Babl *destination_space = conversion->conversion.destination->format.space;
- const Babl *source_space = babl_conversion_get_source_space (conversion);
- float * matrixf = data;
- uint8_t *rgba_in_u8 = (void*)src_char;
- uint8_t *rgba_out_u8 = (void*)dst_char;
- float rgba[4*samples];
- for (int i = 0; i < samples * 4; i+=4)
- {
- rgba_out_u8[i+3] = rgba_in_u8[i+3];
- }
- TRC_IN_u8(rgba_in_u8, rgba);
- babl_matrix_mul_vectorff_buf4 (matrixf, rgba, rgba, samples);
- TRC_OUT_u8(rgba, rgba_out_u8);
-}
-
-
static inline void
universal_rgba_converter (const Babl *conversion,
unsigned char *__restrict__ src_char,
@@ -352,33 +289,6 @@ universal_rgba_converter_sse2 (const Babl *conversion,
babl_matrix_mul_vectorff_buf4_sse2 (matrixf, rgba_in, rgba_out, samples);
}
-static inline void
-universal_nonlinear_rgba_u8_converter_sse2 (const Babl *conversion,
- unsigned char *__restrict__ src_char,
- unsigned char *__restrict__ dst_char,
- long samples,
- void *data)
-{
- const Babl *source_space = conversion->conversion.source->format.space;
- const Babl *destination_space = conversion->conversion.destination->format.space;
-
- float * matrixf = data;
- uint8_t *rgba_in_u8 = (void*)src_char;
- uint8_t *rgba_out_u8 = (void*)dst_char;
-
- float rgba[4*samples];
-
- for (int i = 0; i < samples*4; i+=4)
- {
- rgba_out_u8[i+3] = rgba_in_u8[i+3];
- }
- TRC_IN_u8(rgba_in_u8, rgba);
-
- babl_matrix_mul_vectorff_buf4_sse2 (matrixf, rgba, rgba, samples);
-
- TRC_OUT_u8(rgba, rgba_out_u8);
-}
-
static inline void
universal_nonlinear_rgb_u8_converter_sse2 (const Babl *conversion,
unsigned char *__restrict__ src_char,
@@ -508,17 +418,6 @@ add_rgb_adapter (Babl *babl,
"linear", universal_linear_rgb_nonlinear_converter_sse2,
NULL));
- prep_conversion(babl_conversion_new(
- babl_format_with_space("R'G'B'A u8", space),
- babl_format_with_space("R'G'B'A u8", babl),
- "linear", universal_nonlinear_rgba_u8_converter_sse2,
- NULL));
- prep_conversion(babl_conversion_new(
- babl_format_with_space("R'G'B'A u8", babl),
- babl_format_with_space("R'G'B'A u8", space),
- "linear", universal_nonlinear_rgba_u8_converter_sse2,
- NULL));
-
prep_conversion(babl_conversion_new(
babl_format_with_space("R'G'B' u8", space),
babl_format_with_space("R'G'B' u8", babl),
@@ -569,16 +468,6 @@ add_rgb_adapter (Babl *babl,
NULL));
#endif
- prep_conversion(babl_conversion_new(
- babl_format_with_space("R'G'B'A u8", space),
- babl_format_with_space("R'G'B'A u8", babl),
- "linear", universal_nonlinear_rgba_u8_converter,
- NULL));
- prep_conversion(babl_conversion_new(
- babl_format_with_space("R'G'B'A u8", babl),
- babl_format_with_space("R'G'B'A u8", space),
- "linear", universal_nonlinear_rgba_u8_converter,
- NULL));
#if 1
prep_conversion(babl_conversion_new(
babl_format_with_space("R'G'B' u8", space),
diff --git a/babl/base/babl-trc.c b/babl/base/babl-trc.c
index a2f1d6e..2299b09 100644
--- a/babl/base/babl-trc.c
+++ b/babl/base/babl-trc.c
@@ -496,8 +496,6 @@ BABL_SIMD_SUFFIX (babl_trc_new) (const char *name,
trc_db[i].fun_to_linear_buf = _babl_trc_to_linear_buf_generic;
trc_db[i].fun_from_linear_buf = _babl_trc_from_linear_buf_generic;
- trc_db[i].fun_from_linear_buf_u8 = _babl_trc_from_linear_buf_u8_generic;
- trc_db[i].fun_to_linear_buf_u8 = _babl_trc_to_linear_buf_u8_generic;
switch (trc_db[i].type)
{
@@ -506,14 +504,12 @@ BABL_SIMD_SUFFIX (babl_trc_new) (const char *name,
trc_db[i].fun_from_linear = _babl_trc_linear;
trc_db[i].fun_from_linear_buf = _babl_trc_linear_buf;
trc_db[i].fun_to_linear_buf = _babl_trc_linear_buf;
- //trc_db[i].fun_to_linear_buf_u8 = _babl_trc_linear_buf_u8;
break;
case BABL_TRC_FORMULA_GAMMA:
trc_db[i].fun_to_linear = _babl_trc_gamma_to_linear;
trc_db[i].fun_from_linear = _babl_trc_gamma_from_linear;
trc_db[i].fun_to_linear_buf = _babl_trc_gamma_to_linear_buf;
trc_db[i].fun_from_linear_buf = _babl_trc_gamma_from_linear_buf;
- //trc_db[i].fun_from_linear_buf_u8 = _babl_trc_gamma_from_linear_buf_u8;
trc_db[i].poly_gamma_to_linear_x0 = POLY_GAMMA_X0;
trc_db[i].poly_gamma_to_linear_x1 = POLY_GAMMA_X1;
@@ -588,7 +584,6 @@ BABL_SIMD_SUFFIX (babl_trc_new) (const char *name,
trc_db[i].fun_to_linear = _babl_trc_srgb_to_linear;
trc_db[i].fun_from_linear = _babl_trc_srgb_from_linear;
trc_db[i].fun_from_linear_buf = _babl_trc_srgb_from_linear_buf;
- //trc_db[i].fun_from_linear_buf_u8 = _babl_trc_srgb_from_linear_buf_u8;
trc_db[i].fun_to_linear_buf = _babl_trc_srgb_to_linear_buf;
break;
case BABL_TRC_LUT:
diff --git a/babl/base/babl-trc.h b/babl/base/babl-trc.h
index 4556c96..1901fd2 100644
--- a/babl/base/babl-trc.h
+++ b/babl/base/babl-trc.h
@@ -51,13 +51,6 @@ typedef struct
int out_gap,
int components,
int count);
- void (*fun_to_linear_buf_u8)(const Babl *trc,
- const uint8_t *in,
- float *out,
- int in_gap,
- int out_gap,
- int components,
- int count);
void (*fun_from_linear_buf)(const Babl *trc,
const float *in,
float *out,
@@ -65,13 +58,6 @@ typedef struct
int out_gap,
int components,
int count);
- void (*fun_from_linear_buf_u8)(const Babl *trc,
- const float *in,
- uint8_t *out,
- int in_gap,
- int out_gap,
- int components,
- int count);
BablPolynomial poly_gamma_to_linear;
float poly_gamma_to_linear_x0;
float poly_gamma_to_linear_x1;
@@ -95,26 +81,6 @@ static inline void babl_trc_from_linear_buf (const Babl *trc_,
trc->fun_from_linear_buf (trc_, in, out, in_gap, out_gap, components, count);
}
-static inline void babl_trc_from_linear_buf_u8 (const Babl *trc_,
- const float *in, uint8_t *out,
- int in_gap, int out_gap,
- int components,
- int count)
-{
- BablTRC *trc = (void*)trc_;
- trc->fun_from_linear_buf_u8 (trc_, in, out, in_gap, out_gap, components, count);
-}
-
-static inline void babl_trc_to_linear_buf_u8 (const Babl *trc_,
- const uint8_t *in, float *out,
- int in_gap, int out_gap,
- int components,
- int count)
-{
- BablTRC *trc = (void*)trc_;
- trc->fun_to_linear_buf_u8 (trc_, in, out, in_gap, out_gap, components, count);
-}
-
static inline void babl_trc_to_linear_buf (const Babl *trc_,
const float *in, float *out,
int in_gap, int out_gap,
@@ -141,65 +107,4 @@ void
babl_trc_class_init_generic (void);
-static inline void
-_babl_trc_from_linear_buf_u8_generic (const Babl *trc_,
- const float *__restrict__ in,
- uint8_t *__restrict__ out,
- int in_gap,
- int out_gap,
- int components,
- int count)
-{
- BablTRC *trc = (void*)trc_;
- if (in_gap == out_gap && in_gap == 4 && components == 3)
- {
- for (int i = 0; i < count; i ++)
- for (int c = 0; c < 3; c ++)
- {
- int val = trc->fun_from_linear (trc_, in[4 * i + c]) * 255.0 + 0.5;
- out[4 * i + c] = val > 255 ? 255 : val;
- }
- }
- else
- {
- for (int i = 0; i < count; i ++)
- for (int c = 0; c < components; c ++)
- {
- int val = trc->fun_from_linear (trc_, in[in_gap * i + c]) * 255.0 + 0.5;
- out[out_gap * i + c] = val > 255 ? 255 : 0;
- }
- }
-}
-
-static inline void
-_babl_trc_to_linear_buf_u8_generic (const Babl *trc_,
- const uint8_t *__restrict__ in,
- float *__restrict__ out,
- int in_gap,
- int out_gap,
- int components,
- int count)
-{
- BablTRC *trc = (void*)trc_;
- if (!trc->valid_u8_lut)
- {
- for (int i = 0; i <= 255; i++)
- trc->u8_lut[i] = trc->fun_to_linear (trc_, i/255.0f);
- trc->valid_u8_lut=1;
- }
- if (in_gap == out_gap && in_gap == 4 && components == 3)
- {
- for (int i = 0; i < count; i ++)
- for (int c = 0; c < 3; c ++)
- out[4 * i + c] = trc->u8_lut[in[4 * i + c]];
- }
- else
- {
- for (int i = 0; i < count; i ++)
- for (int c = 0; c < components; c ++)
- out[out_gap * i + c] = trc->u8_lut[in[in_gap * i + c]];
- }
-}
-
-
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]