]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
remove gamm table options
authorBastian Dehn <hhaalo@arcor.de>
Sat, 2 Mar 2024 08:14:04 +0000 (09:14 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 2 Mar 2024 08:14:04 +0000 (09:14 +0100)
src/kds_s2000w_handler.c
src/kds_s2000w_handler_opts.c
src/kds_s2000w_handler_opts.h
src/kds_s2000w_option_descriptors.c
src/kds_s2000w_option_descriptors.h

index a618689ae2616edb46f54debaeccab7fdb9e9170..b55ad3b657e17aad0a3512483999656c9e99dea9 100644 (file)
@@ -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;
index fe5af544781dbe4a31729298bf12097c7eb6a9d9..000f0fa15f990ff366e19343f0d428a0aa92a3ea 100644 (file)
@@ -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;
        }
index 0bdf7d6a3356e358db6336e81ddd19e9ffdea13b..3daecedba86764fb3549dce567c2a23e560b8d7b 100644 (file)
@@ -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);
index 2e55c929131e122279bfa822b09d8d5354a90210..ba6d10ea6d99a0c41dfbe7b5df74778d2eaf65ff 100644 (file)
@@ -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]);
index 49a05c691f8487965df7f8f39046c9ba3bfa6d42..55418cd662205fd40f97f2883a499963a252a775 100644 (file)
@@ -2,7 +2,7 @@
 #define KDS_S2000W_OPTION_DESCRIPTORS_H
 #include <sane/sane.h>
 
-#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();