From 7e3556b61744f03efe739e0410d934b722405700 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Sat, 2 Mar 2024 09:14:04 +0100 Subject: [PATCH] remove gamm table options --- src/kds_s2000w_handler.c | 1 - src/kds_s2000w_handler_opts.c | 25 +------ src/kds_s2000w_handler_opts.h | 1 - src/kds_s2000w_option_descriptors.c | 104 ---------------------------- src/kds_s2000w_option_descriptors.h | 2 +- 5 files changed, 2 insertions(+), 131 deletions(-) diff --git a/src/kds_s2000w_handler.c b/src/kds_s2000w_handler.c index a618689..b55ad3b 100644 --- a/src/kds_s2000w_handler.c +++ b/src/kds_s2000w_handler.c @@ -262,7 +262,6 @@ void kds_s2000w_handler_open(const char* devicename, void** handle) handler* h = init_handler(); *handle = h; - init_gamma_table(); image.size = 0; image.data = NULL; pnm_image.size = 0; diff --git a/src/kds_s2000w_handler_opts.c b/src/kds_s2000w_handler_opts.c index fe5af54..000f0fa 100644 --- a/src/kds_s2000w_handler_opts.c +++ b/src/kds_s2000w_handler_opts.c @@ -5,11 +5,10 @@ #include "kds_s2000w_handler_opts.h" #include "kds_s2000w_debug.h" -#define COUNT_CUSTOM_OPTIONS 8 +#define COUNT_CUSTOM_OPTIONS 4 extern json_object* resp_config; extern json_object* config; -int gamma_table[4][256]; void _write_string_value(json_object* value_object, void* value) { @@ -106,16 +105,6 @@ int _change_skip_blank_pages_off() return 0; } -void init_gamma_table() -{ - for (int i = 0; i < 256; i++) { - gamma_table[0][i] = i; - gamma_table[1][i] = i; - gamma_table[2][i] = i; - gamma_table[3][i] = i; - } -} - void kds_s2000w_handler_get_option(handler* h, int option, void* value, int* info) { config = json_object_object_get(resp_config, "Configuration"); @@ -215,18 +204,6 @@ void kds_s2000w_handler_get_option(handler* h, int option, void* value, int* inf value_object = json_object_object_get(config, "MaxDocumentLength"); _write_int_value(value_object, value); break; - case 26: - memcpy(value, &gamma_table[0][0], sizeof(int) * 256); - break; - case 27: - memcpy(value, &gamma_table[1][0], sizeof(int) * 256); - break; - case 28: - memcpy(value, &gamma_table[2][0], sizeof(int) * 256); - break; - case 29: - memcpy(value, &gamma_table[3][0], sizeof(int) * 256); - break; default: break; } diff --git a/src/kds_s2000w_handler_opts.h b/src/kds_s2000w_handler_opts.h index 0bdf7d6..3daeced 100644 --- a/src/kds_s2000w_handler_opts.h +++ b/src/kds_s2000w_handler_opts.h @@ -1,6 +1,5 @@ #ifndef KDS_S2000W_HANDLER_OPTS_H #define KDS_S2000W_HANDLER_OPTS_H -void init_gamma_table(); void kds_s2000w_handler_get_option(handler* h, int option, void* value, int* info); void kds_s2000w_handler_set_option(handler* h, int option, void* value, int* info); void kds_s2000w_handler_set_option_auto(int option); diff --git a/src/kds_s2000w_option_descriptors.c b/src/kds_s2000w_option_descriptors.c index 2e55c92..ba6d10e 100644 --- a/src/kds_s2000w_option_descriptors.c +++ b/src/kds_s2000w_option_descriptors.c @@ -26,10 +26,6 @@ SANE_Range* constraint_binarization_contrast = NULL; SANE_String_Const* constraint_max_document_length = NULL; SANE_String_Const* constraint_scan_source = NULL; SANE_Word* constraint_depth = NULL; -SANE_Range* constraint_gamma_range = NULL; -SANE_Range* constraint_gamma_range_r = NULL; -SANE_Range* constraint_gamma_range_g = NULL; -SANE_Range* constraint_gamma_range_b = NULL; SANE_Option_Descriptor* _kds_s2000w_option_descriptor_standard_group() { @@ -585,94 +581,6 @@ SANE_Option_Descriptor* _kds_s2000w_option_descriptor_depth() return descriptor; } -SANE_Option_Descriptor* _kds_s2000w_option_descriptor_gamma_vector() -{ - debug_printf(ALL, "kds_s2000w_option_descriptor_gamma_vector"); - SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); - - descriptor->name = SANE_NAME_GAMMA_VECTOR; - descriptor->title = SANE_TITLE_GAMMA_VECTOR; - descriptor->desc = SANE_DESC_GAMMA_VECTOR; - descriptor->type = SANE_TYPE_INT; - descriptor->unit = SANE_UNIT_NONE; - constraint_gamma_range = malloc(sizeof(SANE_Range)); - constraint_gamma_range->min = 0; - constraint_gamma_range->max = 255; - constraint_gamma_range->quant = 0; - descriptor->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT; - descriptor->constraint_type = SANE_CONSTRAINT_RANGE; - descriptor->constraint.range = constraint_gamma_range; - descriptor->size = sizeof(SANE_Int) * 256; - - return descriptor; -} - -SANE_Option_Descriptor* _kds_s2000w_option_descriptor_gamma_vector_r() -{ - debug_printf(ALL, "kds_s2000w_option_descriptor_gamma_vector_r"); - SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); - - descriptor->name = SANE_NAME_GAMMA_VECTOR_R; - descriptor->title = SANE_TITLE_GAMMA_VECTOR_R; - descriptor->desc = SANE_DESC_GAMMA_VECTOR_R; - descriptor->type = SANE_TYPE_INT; - descriptor->unit = SANE_UNIT_NONE; - constraint_gamma_range_r = malloc(sizeof(SANE_Range)); - constraint_gamma_range_r->min = 0; - constraint_gamma_range_r->max = 255; - constraint_gamma_range_r->quant = 0; - descriptor->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT; - descriptor->constraint_type = SANE_CONSTRAINT_RANGE; - descriptor->constraint.range = constraint_gamma_range_r; - descriptor->size = sizeof(SANE_Int) * 256; - - return descriptor; -} - -SANE_Option_Descriptor* _kds_s2000w_option_descriptor_gamma_vector_g() -{ - debug_printf(ALL, "kds_s2000w_option_descriptor_gamma_vector_g"); - SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); - - descriptor->name = SANE_NAME_GAMMA_VECTOR_G; - descriptor->title = SANE_TITLE_GAMMA_VECTOR_G; - descriptor->desc = SANE_DESC_GAMMA_VECTOR_G; - descriptor->type = SANE_TYPE_INT; - descriptor->unit = SANE_UNIT_NONE; - constraint_gamma_range_g = malloc(sizeof(SANE_Range)); - constraint_gamma_range_g->min = 0; - constraint_gamma_range_g->max = 255; - constraint_gamma_range_g->quant = 0; - descriptor->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT; - descriptor->constraint_type = SANE_CONSTRAINT_RANGE; - descriptor->constraint.range = constraint_gamma_range_g; - descriptor->size = sizeof(SANE_Int) * 256; - - return descriptor; -} - -SANE_Option_Descriptor* _kds_s2000w_option_descriptor_gamma_vector_b() -{ - debug_printf(ALL, "kds_s2000w_option_descriptor_gamma_vector_b"); - SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); - - descriptor->name = SANE_NAME_GAMMA_VECTOR_B; - descriptor->title = SANE_TITLE_GAMMA_VECTOR_B; - descriptor->desc = SANE_DESC_GAMMA_VECTOR_B; - descriptor->type = SANE_TYPE_INT; - descriptor->unit = SANE_UNIT_NONE; - constraint_gamma_range_b = malloc(sizeof(SANE_Range)); - constraint_gamma_range_b->min = 0; - constraint_gamma_range_b->max = 255; - constraint_gamma_range_b->quant = 0; - descriptor->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT; - descriptor->constraint_type = SANE_CONSTRAINT_RANGE; - descriptor->constraint.range = constraint_gamma_range_b; - descriptor->size = sizeof(SANE_Int) * 256; - - return descriptor; -} - void kds_s2000w_option_descriptor_init_option_descriptors() { debug_printf(ALL, "kds_s2000w_option_descriptor_init_option_descriptors"); @@ -704,10 +612,6 @@ void kds_s2000w_option_descriptor_init_option_descriptors() descriptor_array[23] = _kds_s2000w_option_descriptor_binarization_contrast(); descriptor_array[24] = _kds_s2000w_option_descriptor_max_document_length(); descriptor_array[25] = _kds_s2000w_option_descriptor_config_reset(); - descriptor_array[26] = _kds_s2000w_option_descriptor_gamma_vector(); - descriptor_array[27] = _kds_s2000w_option_descriptor_gamma_vector_r(); - descriptor_array[28] = _kds_s2000w_option_descriptor_gamma_vector_g(); - descriptor_array[29] = _kds_s2000w_option_descriptor_gamma_vector_b(); } void kds_s2000w_option_descriptor_free_option_descriptors() @@ -755,14 +659,6 @@ void kds_s2000w_option_descriptor_free_option_descriptors() constraint_scan_source = NULL; free(constraint_depth); constraint_depth = NULL; - free(constraint_gamma_range); - constraint_gamma_range = NULL; - free(constraint_gamma_range_r); - constraint_gamma_range_r = NULL; - free(constraint_gamma_range_g); - constraint_gamma_range_g = NULL; - free(constraint_gamma_range_b); - constraint_gamma_range_b =NULL; for (int i = 0; i < MAX_OPTION_COUNT; i++) { free(descriptor_array[i]); diff --git a/src/kds_s2000w_option_descriptors.h b/src/kds_s2000w_option_descriptors.h index 49a05c6..55418cd 100644 --- a/src/kds_s2000w_option_descriptors.h +++ b/src/kds_s2000w_option_descriptors.h @@ -2,7 +2,7 @@ #define KDS_S2000W_OPTION_DESCRIPTORS_H #include -#define MAX_OPTION_COUNT 30 +#define MAX_OPTION_COUNT 26 void kds_s2000w_option_descriptor_init_option_descriptors(); void kds_s2000w_option_descriptor_free_option_descriptors(); -- 2.39.5