From 648a24830f04ea6f972094828bdb9335b6246ac4 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Mon, 13 Apr 2020 07:23:37 +0300 Subject: [PATCH 1/7] genesys: Use output_pixel_offset for CCD offsets on gl646 --- backend/genesys/low.cpp | 7 +- backend/genesys/tables_sensor.cpp | 116 +++++++++++++++++------------- 2 files changed, 67 insertions(+), 56 deletions(-) diff --git a/backend/genesys/low.cpp b/backend/genesys/low.cpp index b622371b8..59f958754 100644 --- a/backend/genesys/low.cpp +++ b/backend/genesys/low.cpp @@ -830,12 +830,7 @@ void compute_session_pixel_offsets(const Genesys_Device* dev, ScanSession& s, unsigned ccd_pixels_per_system_pixel = sensor.ccd_pixels_per_system_pixel(); if (dev->model->asic_type == AsicType::GL646) { - - // startx cannot be below dummy pixel value - s.pixel_startx = sensor.dummy_pixel; - - s.pixel_startx += s.params.startx * sensor.optical_res / s.params.xres; - + s.pixel_startx += s.output_startx * sensor.optical_res / s.params.xres; s.pixel_endx = s.pixel_startx + s.optical_pixels * s.ccd_size_divisor; } else if (dev->model->asic_type == AsicType::GL841) { diff --git a/backend/genesys/tables_sensor.cpp b/backend/genesys/tables_sensor.cpp index 519880a39..94e17945c 100644 --- a/backend/genesys/tables_sensor.cpp +++ b/backend/genesys/tables_sensor.cpp @@ -119,19 +119,21 @@ void genesys_init_sensor_tables() { ValueFilterAny resolutions; unsigned register_dpiset; + unsigned output_pixel_offset; }; CustomSensorSettings custom_settings[] = { - { { 75 }, 150 }, - { { 150 }, 300 }, - { { 300 }, 600 }, - { { 600 }, 1200 }, - { { 1200 }, 2400 }, + { { 75 }, 150, 4 }, + { { 150 }, 300, 8 }, + { { 300 }, 600, 16 }, + { { 600 }, 1200, 32 }, + { { 1200 }, 2400, 64 }, }; for (const CustomSensorSettings& setting : custom_settings) { sensor.resolutions = setting.resolutions; sensor.register_dpiset = setting.register_dpiset; + sensor.output_pixel_offset = setting.output_pixel_offset; s_sensors->push_back(sensor); } } @@ -160,18 +162,20 @@ void genesys_init_sensor_tables() struct CustomSensorSettings { ValueFilterAny resolutions; + unsigned output_pixel_offset; }; CustomSensorSettings custom_settings[] = { - { { 75 } }, - { { 150 } }, - { { 300 } }, - { { 600 } }, + { { 75 }, 10 }, + { { 150 }, 21 }, + { { 300 }, 42 }, + { { 600 }, 85 }, }; for (const CustomSensorSettings& setting : custom_settings) { sensor.resolutions = setting.resolutions; sensor.register_dpiset = setting.resolutions.values()[0]; + sensor.output_pixel_offset = setting.output_pixel_offset; s_sensors->push_back(sensor); } } @@ -201,19 +205,21 @@ void genesys_init_sensor_tables() { ValueFilterAny resolutions; unsigned register_dpiset; + unsigned output_pixel_offset; }; CustomSensorSettings custom_settings[] = { - { { 75 }, 150 }, - { { 150 }, 300 }, - { { 300 }, 600 }, - { { 600 }, 1200 }, - { { 1200 }, 2400 }, + { { 75 }, 150, 4 }, + { { 150 }, 300, 8 }, + { { 300 }, 600, 16 }, + { { 600 }, 1200, 32 }, + { { 1200 }, 2400, 64 }, }; for (const CustomSensorSettings& setting : custom_settings) { sensor.resolutions = setting.resolutions; sensor.register_dpiset = setting.register_dpiset; + sensor.output_pixel_offset = setting.output_pixel_offset; s_sensors->push_back(sensor); } } @@ -248,11 +254,12 @@ void genesys_init_sensor_tables() unsigned exposure_lperiod; unsigned ccd_size_divisor; Ratio pixel_count_ratio; + unsigned output_pixel_offset; GenesysRegisterSettingSet custom_regs; }; CustomSensorSettings custom_settings[] = { - { { 50 }, 100, 12000, 2, Ratio{1, 2}, { + { { 50 }, 100, 12000, 2, Ratio{1, 2}, 0, { { 0x08, 0x00 }, { 0x09, 0x05 }, { 0x0a, 0x06 }, { 0x0b, 0x08 }, { 0x16, 0x0b }, { 0x17, 0x0a }, { 0x18, 0x28 }, { 0x19, 0x2a }, { 0x1a, 0x00 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x03 }, @@ -261,7 +268,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x00 }, { 0x5c, 0x00 }, { 0x5d, 0x00 }, { 0x5e, 0x00 } } }, - { { 75 }, 150, 11000, 2, Ratio{1, 2}, { + { { 75 }, 150, 11000, 2, Ratio{1, 2}, 1, { { 0x08, 0x00 }, { 0x09, 0x05 }, { 0x0a, 0x06 }, { 0x0b, 0x08 }, { 0x16, 0x0b }, { 0x17, 0x0a }, { 0x18, 0x28 }, { 0x19, 0x2a }, { 0x1a, 0x00 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x03 }, @@ -270,7 +277,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x00 }, { 0x5c, 0x00 }, { 0x5d, 0x00 }, { 0x5e, 0x00 } } }, - { { 100 }, 200, 11000, 2, Ratio{1, 2}, { + { { 100 }, 200, 11000, 2, Ratio{1, 2}, 1, { { 0x08, 0x00 }, { 0x09, 0x05 }, { 0x0a, 0x06 }, { 0x0b, 0x08 }, { 0x16, 0x0b }, { 0x17, 0x0a }, { 0x18, 0x28 }, { 0x19, 0x2a }, { 0x1a, 0x00 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x03 }, @@ -279,7 +286,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x00 }, { 0x5c, 0x00 }, { 0x5d, 0x00 }, { 0x5e, 0x00 } } }, - { { 150 }, 300, 11000, 2, Ratio{1, 2}, { + { { 150 }, 300, 11000, 2, Ratio{1, 2}, 2, { { 0x08, 0x00 }, { 0x09, 0x05 }, { 0x0a, 0x06 }, { 0x0b, 0x08 }, { 0x16, 0x0b }, { 0x17, 0x0a }, { 0x18, 0x28 }, { 0x19, 0x2a }, { 0x1a, 0x00 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x03 }, @@ -288,7 +295,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x00 }, { 0x5c, 0x00 }, { 0x5d, 0x00 }, { 0x5e, 0x00 } } }, - { { 200 }, 400, 11000, 2, Ratio{1, 2}, { + { { 200 }, 400, 11000, 2, Ratio{1, 2}, 2, { { 0x08, 0x00 }, { 0x09, 0x05 }, { 0x0a, 0x06 }, { 0x0b, 0x08 }, { 0x16, 0x0b }, { 0x17, 0x0a }, { 0x18, 0x28 }, { 0x19, 0x2a }, { 0x1a, 0x00 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x03 }, @@ -297,7 +304,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x00 }, { 0x5c, 0x00 }, { 0x5d, 0x00 }, { 0x5e, 0x00 } } }, - { { 300 }, 600, 11000, 2, Ratio{1, 2}, { + { { 300 }, 600, 11000, 2, Ratio{1, 2}, 4, { { 0x08, 0x00 }, { 0x09, 0x05 }, { 0x0a, 0x06 }, { 0x0b, 0x08 }, { 0x16, 0x0b }, { 0x17, 0x0a }, { 0x18, 0x28 }, { 0x19, 0x2a }, { 0x1a, 0x00 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x03 }, @@ -306,7 +313,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x00 }, { 0x5c, 0x00 }, { 0x5d, 0x00 }, { 0x5e, 0x00 } } }, - { { 400 }, 800, 11000, 2, Ratio{1, 2}, { + { { 400 }, 800, 11000, 2, Ratio{1, 2}, 5, { { 0x08, 0x00 }, { 0x09, 0x05 }, { 0x0a, 0x06 }, { 0x0b, 0x08 }, { 0x16, 0x0b }, { 0x17, 0x0a }, { 0x18, 0x28 }, { 0x19, 0x2a }, { 0x1a, 0x00 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x03 }, @@ -315,7 +322,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x00 }, { 0x5c, 0x00 }, { 0x5d, 0x00 }, { 0x5e, 0x00 } } }, - { { 600 }, 1200, 11000, 2, Ratio{1, 2}, { + { { 600 }, 1200, 11000, 2, Ratio{1, 2}, 8, { { 0x08, 0x00 }, { 0x09, 0x05 }, { 0x0a, 0x06 }, { 0x0b, 0x08 }, { 0x16, 0x0b }, { 0x17, 0x0a }, { 0x18, 0x28 }, { 0x19, 0x2a }, { 0x1a, 0x00 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x03 }, @@ -324,7 +331,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x00 }, { 0x5c, 0x00 }, { 0x5d, 0x00 }, { 0x5e, 0x00 } } }, - { { 1200 }, 1200, 11000, 1, Ratio{1, 1}, { + { { 1200 }, 1200, 11000, 1, Ratio{1, 1}, 16, { { 0x08, 0x0d }, { 0x09, 0x0f }, { 0x0a, 0x11 }, { 0x0b, 0x13 }, { 0x16, 0x0b }, { 0x17, 0x0a }, { 0x18, 0x30 }, { 0x19, 0x2a }, { 0x1a, 0x00 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x03 }, @@ -342,6 +349,7 @@ void genesys_init_sensor_tables() sensor.exposure_lperiod = setting.exposure_lperiod; sensor.ccd_size_divisor = setting.ccd_size_divisor; sensor.pixel_count_ratio = setting.pixel_count_ratio; + sensor.output_pixel_offset = setting.output_pixel_offset; sensor.custom_regs = setting.custom_regs; s_sensors->push_back(sensor); } @@ -375,11 +383,12 @@ void genesys_init_sensor_tables() unsigned register_dpiset; unsigned exposure_lperiod; Ratio pixel_count_ratio; + unsigned output_pixel_offset; GenesysRegisterSettingSet custom_regs; }; CustomSensorSettings custom_settings[] = { - { { 50 }, 200, 7211, Ratio{1, 4}, { + { { 50 }, 200, 7211, Ratio{1, 4}, 0, { { 0x08, 0x14 }, { 0x09, 0x15 }, { 0x0a, 0x00 }, { 0x0b, 0x00 }, { 0x16, 0xbf }, { 0x17, 0x08 }, { 0x18, 0x3f }, { 0x19, 0x2a }, { 0x1a, 0x00 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x02 }, @@ -388,7 +397,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x00 }, { 0x5c, 0x00 }, { 0x5d, 0x00 }, { 0x5e, 0x00 } } }, - { { 100 }, 400, 7211, Ratio{1, 4}, { + { { 100 }, 400, 7211, Ratio{1, 4}, 1, { { 0x08, 0x14 }, { 0x09, 0x15 }, { 0x0a, 0x00 }, { 0x0b, 0x00 }, { 0x16, 0xbf }, { 0x17, 0x08 }, { 0x18, 0x3f }, { 0x19, 0x2a }, { 0x1a, 0x00 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x02 }, @@ -397,7 +406,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x00 }, { 0x5c, 0x00 }, { 0x5d, 0x00 }, { 0x5e, 0x00 } } }, - { { 150 }, 600, 7211, Ratio{1, 4}, { + { { 150 }, 600, 7211, Ratio{1, 4}, 1, { { 0x08, 0x14 }, { 0x09, 0x15 }, { 0x0a, 0x00 }, { 0x0b, 0x00 }, { 0x16, 0xbf }, { 0x17, 0x08 }, { 0x18, 0x3f }, { 0x19, 0x2a }, { 0x1a, 0x00 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x02 }, @@ -406,7 +415,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x00 }, { 0x5c, 0x00 }, { 0x5d, 0x00 }, { 0x5e, 0x00 } } }, - { { 300 }, 1200, 8751, Ratio{1, 4}, { + { { 300 }, 1200, 8751, Ratio{1, 4}, 3, { { 0x08, 0x14 }, { 0x09, 0x15 }, { 0x0a, 0x00 }, { 0x0b, 0x00 }, { 0x16, 0xbf }, { 0x17, 0x08 }, { 0x18, 0x3f }, { 0x19, 0x2a }, { 0x1a, 0x00 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x02 }, @@ -415,7 +424,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x00 }, { 0x5c, 0x00 }, { 0x5d, 0x00 }, { 0x5e, 0x00 } } }, - { { 600 }, 1200, 18760, Ratio{1, 2}, { + { { 600 }, 1200, 18760, Ratio{1, 2}, 7, { { 0x08, 0x0e }, { 0x09, 0x0f }, { 0x0a, 0x00 }, { 0x0b, 0x00 }, { 0x16, 0xbf }, { 0x17, 0x08 }, { 0x18, 0x31 }, { 0x19, 0x2a }, { 0x1a, 0x00 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x02 }, @@ -424,7 +433,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x00 }, { 0x5c, 0x00 }, { 0x5d, 0x00 }, { 0x5e, 0x00 } } }, - { { 1200 }, 1200, 21749, Ratio{1, 1}, { + { { 1200 }, 1200, 21749, Ratio{1, 1}, 15, { { 0x08, 0x02 }, { 0x09, 0x04 }, { 0x0a, 0x00 }, { 0x0b, 0x00 }, { 0x16, 0xbf }, { 0x17, 0x08 }, { 0x18, 0x30 }, { 0x19, 0x2a }, { 0x1a, 0x00 }, { 0x1b, 0x00 }, { 0x1c, 0xc0 }, { 0x1d, 0x42 }, @@ -441,6 +450,7 @@ void genesys_init_sensor_tables() sensor.register_dpiset = setting.register_dpiset; sensor.exposure_lperiod = setting.exposure_lperiod; sensor.pixel_count_ratio = setting.pixel_count_ratio; + sensor.output_pixel_offset = setting.output_pixel_offset; sensor.custom_regs = setting.custom_regs; s_sensors->push_back(sensor); } @@ -475,11 +485,12 @@ void genesys_init_sensor_tables() unsigned exposure_lperiod; unsigned ccd_size_divisor; Ratio pixel_count_ratio; + unsigned output_pixel_offset; GenesysRegisterSettingSet custom_regs; }; CustomSensorSettings custom_settings[] = { - { { 75 }, 150, 4480, 2, Ratio{1, 2}, { + { { 75 }, 150, 4480, 2, Ratio{1, 2}, 2, { { 0x08, 0x16 }, { 0x09, 0x00 }, { 0x0a, 0x01 }, { 0x0b, 0x03 }, { 0x16, 0xb7 }, { 0x17, 0x0a }, { 0x18, 0x20 }, { 0x19, 0x2a }, { 0x1a, 0x6a }, { 0x1b, 0x8a }, { 0x1c, 0x00 }, { 0x1d, 0x85 }, @@ -488,7 +499,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x06 }, { 0x5c, 0x0b }, { 0x5d, 0x10 }, { 0x5e, 0x16 } } }, - { { 150 }, 300, 4350, 2, Ratio{1, 2}, { + { { 150 }, 300, 4350, 2, Ratio{1, 2}, 5, { { 0x08, 0x16 }, { 0x09, 0x00 }, { 0x0a, 0x01 }, { 0x0b, 0x03 }, { 0x16, 0xb7 }, { 0x17, 0x0a }, { 0x18, 0x20 }, { 0x19, 0x2a }, { 0x1a, 0x6a }, { 0x1b, 0x8a }, { 0x1c, 0x00 }, { 0x1d, 0x85 }, @@ -497,7 +508,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x06 }, { 0x5c, 0x0b }, { 0x5d, 0x10 }, { 0x5e, 0x16 } } }, - { { 300 }, 600, 4350, 2, Ratio{1, 2}, { + { { 300 }, 600, 4350, 2, Ratio{1, 2}, 10, { { 0x08, 0x16 }, { 0x09, 0x00 }, { 0x0a, 0x01 }, { 0x0b, 0x03 }, { 0x16, 0xb7 }, { 0x17, 0x0a }, { 0x18, 0x20 }, { 0x19, 0x2a }, { 0x1a, 0x6a }, { 0x1b, 0x8a }, { 0x1c, 0x00 }, { 0x1d, 0x85 }, @@ -506,7 +517,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x06 }, { 0x5c, 0x0b }, { 0x5d, 0x10 }, { 0x5e, 0x16 } } }, - { { 600 }, 600, 8700, 1, Ratio{1, 1}, { + { { 600 }, 600, 8700, 1, Ratio{1, 1}, 20, { { 0x08, 0x01 }, { 0x09, 0x03 }, { 0x0a, 0x04 }, { 0x0b, 0x06 }, { 0x16, 0xb7 }, { 0x17, 0x0a }, { 0x18, 0x20 }, { 0x19, 0x2a }, { 0x1a, 0x6a }, { 0x1b, 0x8a }, { 0x1c, 0x00 }, { 0x1d, 0x05 }, @@ -524,6 +535,7 @@ void genesys_init_sensor_tables() sensor.exposure_lperiod = setting.exposure_lperiod; sensor.ccd_size_divisor = setting.ccd_size_divisor; sensor.pixel_count_ratio = setting.pixel_count_ratio; + sensor.output_pixel_offset = setting.output_pixel_offset; sensor.custom_regs = setting.custom_regs; s_sensors->push_back(sensor); } @@ -624,19 +636,20 @@ void genesys_init_sensor_tables() std::vector channels; unsigned exposure_lperiod; SensorExposure exposure; + unsigned output_pixel_offset; }; CustomSensorSettings custom_settings[] = { - { { 75 }, { 3 }, 5700, { 0x1644, 0x0c80, 0x092e } }, - { { 100 }, { 3 }, 5700, { 0x1644, 0x0c80, 0x092e } }, - { { 200 }, { 3 }, 5700, { 0x1644, 0x0c80, 0x092e } }, - { { 300 }, { 3 }, 9000, { 0x1644, 0x0c80, 0x092e } }, - { { 600 }, { 3 }, 16000, { 0x1644, 0x0c80, 0x092e } }, - { { 75 }, { 1 }, 16000, { 0x050a, 0x0fa0, 0x1010 } }, - { { 100 }, { 1 }, 7800, { 0x050a, 0x0fa0, 0x1010 } }, - { { 200 }, { 1 }, 11000, { 0x050a, 0x0fa0, 0x1010 } }, - { { 300 }, { 1 }, 13000, { 0x050a, 0x0fa0, 0x1010 } }, - { { 600 }, { 1 }, 24000, { 0x050a, 0x0fa0, 0x1010 } }, + { { 75 }, { 3 }, 5700, { 0x1644, 0x0c80, 0x092e }, 4 }, + { { 100 }, { 3 }, 5700, { 0x1644, 0x0c80, 0x092e }, 6 }, + { { 200 }, { 3 }, 5700, { 0x1644, 0x0c80, 0x092e }, 12 }, + { { 300 }, { 3 }, 9000, { 0x1644, 0x0c80, 0x092e }, 19 }, + { { 600 }, { 3 }, 16000, { 0x1644, 0x0c80, 0x092e }, 38 }, + { { 75 }, { 1 }, 16000, { 0x050a, 0x0fa0, 0x1010 }, 4 }, + { { 100 }, { 1 }, 7800, { 0x050a, 0x0fa0, 0x1010 }, 6 }, + { { 200 }, { 1 }, 11000, { 0x050a, 0x0fa0, 0x1010 }, 12 }, + { { 300 }, { 1 }, 13000, { 0x050a, 0x0fa0, 0x1010 }, 19 }, + { { 600 }, { 1 }, 24000, { 0x050a, 0x0fa0, 0x1010 }, 38 }, }; for (const CustomSensorSettings& setting : custom_settings) @@ -646,6 +659,7 @@ void genesys_init_sensor_tables() sensor.register_dpiset = setting.resolutions.values()[0]; sensor.exposure_lperiod = setting.exposure_lperiod; sensor.exposure = setting.exposure; + sensor.output_pixel_offset = setting.output_pixel_offset; s_sensors->push_back(sensor); } } @@ -678,11 +692,12 @@ void genesys_init_sensor_tables() unsigned register_dpiset; unsigned exposure_lperiod; Ratio pixel_count_ratio; + unsigned output_pixel_offset; GenesysRegisterSettingSet custom_regs; }; CustomSensorSettings custom_settings[] = { - { { 50 }, 200, 5758, Ratio{1, 4}, { + { { 50 }, 200, 5758, Ratio{1, 4}, 0, { { 0x08, 0x00 }, { 0x09, 0x0a }, { 0x0a, 0x0b }, { 0x0b, 0x0d }, { 0x16, 0x33 }, { 0x17, 0x07 }, { 0x18, 0x33 }, { 0x19, 0x2a }, { 0x1a, 0x02 }, { 0x1b, 0x13 }, { 0x1c, 0xc0 }, { 0x1d, 0x43 }, @@ -691,7 +706,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x05 }, { 0x5c, 0x0a }, { 0x5d, 0x0f }, { 0x5e, 0x00 } } }, - { { 75 }, 300, 4879, Ratio{1, 4}, { + { { 75 }, 300, 4879, Ratio{1, 4}, 1, { { 0x08, 0x00 }, { 0x09, 0x0a }, { 0x0a, 0x0b }, { 0x0b, 0x0d }, { 0x16, 0x33 }, { 0x17, 0x07 }, { 0x18, 0x33 }, { 0x19, 0x2a }, { 0x1a, 0x02 }, { 0x1b, 0x13 }, { 0x1c, 0xc0 }, { 0x1d, 0x43 }, @@ -700,7 +715,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x05 }, { 0x5c, 0x0a }, { 0x5d, 0x0f }, { 0x5e, 0x00 } } }, - { { 100 }, 400, 4487, Ratio{1, 4}, { + { { 100 }, 400, 4487, Ratio{1, 4}, 1, { { 0x08, 0x00 }, { 0x09, 0x0a }, { 0x0a, 0x0b }, { 0x0b, 0x0d }, { 0x16, 0x33 }, { 0x17, 0x07 }, { 0x18, 0x33 }, { 0x19, 0x2a }, { 0x1a, 0x02 }, { 0x1b, 0x13 }, { 0x1c, 0xc0 }, { 0x1d, 0x43 }, @@ -709,7 +724,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x05 }, { 0x5c, 0x0a }, { 0x5d, 0x0f }, { 0x5e, 0x00 } } }, - { { 150 }, 600, 4879, Ratio{1, 4}, { + { { 150 }, 600, 4879, Ratio{1, 4}, 2, { { 0x08, 0x00 }, { 0x09, 0x0a }, { 0x0a, 0x0b }, { 0x0b, 0x0d }, { 0x16, 0x33 }, { 0x17, 0x07 }, { 0x18, 0x33 }, { 0x19, 0x2a }, { 0x1a, 0x02 }, { 0x1b, 0x13 }, { 0x1c, 0xc0 }, { 0x1d, 0x43 }, @@ -718,7 +733,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x05 }, { 0x5c, 0x0a }, { 0x5d, 0x0f }, { 0x5e, 0x00 } } }, - { { 300 }, 1200, 4503, Ratio{1, 4}, { + { { 300 }, 1200, 4503, Ratio{1, 4}, 4, { { 0x08, 0x00 }, { 0x09, 0x0a }, { 0x0a, 0x0b }, { 0x0b, 0x0d }, { 0x16, 0x33 }, { 0x17, 0x07 }, { 0x18, 0x33 }, { 0x19, 0x2a }, { 0x1a, 0x02 }, { 0x1b, 0x13 }, { 0x1c, 0xc0 }, { 0x1d, 0x43 }, @@ -727,7 +742,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x05 }, { 0x5c, 0x0a }, { 0x5d, 0x0f }, { 0x5e, 0x00 } } }, - { { 600 }, 1200, 10251, Ratio{1, 2}, { + { { 600 }, 1200, 10251, Ratio{1, 2}, 8, { { 0x08, 0x00 }, { 0x09, 0x05 }, { 0x0a, 0x06 }, { 0x0b, 0x08 }, { 0x16, 0x33 }, { 0x17, 0x07 }, { 0x18, 0x31 }, { 0x19, 0x2a }, { 0x1a, 0x02 }, { 0x1b, 0x0e }, { 0x1c, 0xc0 }, { 0x1d, 0x43 }, @@ -736,7 +751,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x02 }, { 0x5c, 0x0e }, { 0x5d, 0x00 }, { 0x5e, 0x00 } } }, - { { 1200 }, 1200, 12750, Ratio{1, 1}, { + { { 1200 }, 1200, 12750, Ratio{1, 1}, 16, { { 0x08, 0x0d }, { 0x09, 0x0f }, { 0x0a, 0x11 }, { 0x0b, 0x13 }, { 0x16, 0x2b }, { 0x17, 0x07 }, { 0x18, 0x30 }, { 0x19, 0x2a }, { 0x1a, 0x00 }, { 0x1b, 0x00 }, { 0x1c, 0xc0 }, { 0x1d, 0x43 }, @@ -753,6 +768,7 @@ void genesys_init_sensor_tables() sensor.register_dpiset = setting.register_dpiset; sensor.exposure_lperiod = setting.exposure_lperiod; sensor.pixel_count_ratio = setting.pixel_count_ratio; + sensor.output_pixel_offset = setting.output_pixel_offset; sensor.custom_regs = setting.custom_regs; s_sensors->push_back(sensor); } From dc00ab867bc80d84c5e2691e2a0f85158b480401 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Mon, 13 Apr 2020 07:23:38 +0300 Subject: [PATCH 2/7] genesys: Use output_pixel_offset for CCD offsets on gl841 --- backend/genesys/gl841.cpp | 29 ++++---- backend/genesys/low.cpp | 8 +-- backend/genesys/tables_sensor.cpp | 112 +++++++++++++++++------------- 3 files changed, 79 insertions(+), 70 deletions(-) diff --git a/backend/genesys/gl841.cpp b/backend/genesys/gl841.cpp index 249948447..6124242e0 100644 --- a/backend/genesys/gl841.cpp +++ b/backend/genesys/gl841.cpp @@ -2838,33 +2838,30 @@ void CommandSetGl841::send_shading_data(Genesys_Device* dev, const Genesys_Senso { DBG_HELPER_ARGS(dbg, "writing %d bytes of shading data", size); uint32_t length, x, pixels, i; - std::uint16_t beginpixel; uint8_t *ptr,*src; /* old method if no SHDAREA */ if ((dev->reg.find_reg(0x01).value & REG_0x01_SHDAREA) == 0) { + // Note that this requires the sensor pixel offset to be exactly the same as to start + // reading from dummy_pixel + 1 position. dev->interface->write_buffer(0x3c, 0x0000, data, size); return; } /* data is whole line, we extract only the part for the scanned area */ length = static_cast(size / 3); - unsigned strpixel = dev->session.pixel_startx; - unsigned endpixel = dev->session.pixel_endx; - /* turn pixel value into bytes 2x16 bits words */ - strpixel*=2*2; /* 2 words of 2 bytes */ - endpixel*=2*2; - pixels=endpixel-strpixel; + // turn pixel value into bytes 2x16 bits words + pixels = dev->session.pixel_endx - dev->session.pixel_startx; + pixels *= 4; - /* shading pixel begin is start pixel minus start pixel during shading - * calibration. Currently only cases handled are full and half ccd resolution. - */ - beginpixel = sensor.ccd_start_xoffset / dev->session.ccd_size_divisor; - beginpixel += sensor.dummy_pixel + 1; - DBG(DBG_io2, "%s: ORIGIN PIXEL=%d\n", __func__, beginpixel); - beginpixel = (strpixel - beginpixel * 2 * 2) / sensor.shading_factor; - DBG(DBG_io2, "%s: BEGIN PIXEL=%d\n", __func__, beginpixel/4); + // shading pixel begin is start pixel minus start pixel during shading + // calibration. Currently only cases handled are full and half ccd resolution. + unsigned beginpixel = dev->session.params.startx * dev->session.optical_resolution / + dev->session.params.xres; + DBG(DBG_io2, "%s: ORIGIN PIXEL=%d\n", __func__, beginpixel); + beginpixel *= 4; + beginpixel /= sensor.shading_factor; dev->interface->record_key_value("shading_offset", std::to_string(beginpixel)); dev->interface->record_key_value("shading_pixels", std::to_string(pixels)); @@ -2888,7 +2885,7 @@ void CommandSetGl841::send_shading_data(Genesys_Device* dev, const Genesys_Senso for(x=0;xmodel->asic_type == AsicType::GL841) { - unsigned startx = s.params.startx * sensor.optical_res / s.params.xres; - - s.pixel_startx = ((sensor.ccd_start_xoffset + startx) * s.optical_resolution) - / sensor.optical_res; - - s.pixel_startx += sensor.dummy_pixel + 1; - + s.pixel_startx = (s.output_startx * s.optical_resolution) / s.params.xres; s.pixel_endx = s.pixel_startx + s.optical_pixels; } else if (dev->model->asic_type == AsicType::GL843) { diff --git a/backend/genesys/tables_sensor.cpp b/backend/genesys/tables_sensor.cpp index 94e17945c..c38234655 100644 --- a/backend/genesys/tables_sensor.cpp +++ b/backend/genesys/tables_sensor.cpp @@ -581,16 +581,17 @@ void genesys_init_sensor_tables() unsigned register_dpihw; unsigned register_dpiset; unsigned shading_resolution; + unsigned output_pixel_offset; }; CustomSensorSettings custom_settings[] = { - { { 75 }, 1200, 150, 600 }, - { { 100 }, 1200, 200, 600 }, - { { 150 }, 1200, 300, 600 }, - { { 200 }, 1200, 400, 600 }, - { { 300 }, 1200, 600, 600 }, - { { 600 }, 1200, 1200, 600 }, - { { 1200 }, 1200, 1200, 1200 }, + { { 75 }, 1200, 150, 600, 11 }, + { { 100 }, 1200, 200, 600, 14 }, + { { 150 }, 1200, 300, 600, 22 }, + { { 200 }, 1200, 400, 600, 29 }, + { { 300 }, 1200, 600, 600, 44 }, + { { 600 }, 1200, 1200, 600, 88 }, + { { 1200 }, 1200, 1200, 1200, 88 }, }; for (const CustomSensorSettings& setting : custom_settings) { @@ -598,6 +599,7 @@ void genesys_init_sensor_tables() sensor.register_dpihw = setting.register_dpihw; sensor.register_dpiset = setting.register_dpiset; sensor.shading_resolution = setting.shading_resolution; + sensor.output_pixel_offset = setting.output_pixel_offset; s_sensors->push_back(sensor); } } @@ -813,19 +815,21 @@ void genesys_init_sensor_tables() { ValueFilterAny resolutions; unsigned register_dpiset; + unsigned output_pixel_offset; }; CustomSensorSettings custom_settings[] = { - { { 75 }, 75 }, - { { 150 }, 150 }, - { { 300 }, 300 }, - { { 600 }, 600 }, - { { 1200 }, 1200 }, + { { 75 }, 75, 1 }, + { { 150 }, 150, 3 }, + { { 300 }, 300, 7 }, + { { 600 }, 600, 14 }, + { { 1200 }, 1200, 28 }, }; for (const CustomSensorSettings& setting : custom_settings) { sensor.resolutions = setting.resolutions; sensor.register_dpiset = setting.register_dpiset; + sensor.output_pixel_offset = setting.output_pixel_offset; s_sensors->push_back(sensor); } } @@ -868,19 +872,21 @@ void genesys_init_sensor_tables() { ValueFilterAny resolutions; unsigned register_dpiset; + unsigned output_pixel_offset; }; CustomSensorSettings custom_settings[] = { - { { 75 }, 75 }, - { { 150 }, 150 }, - { { 300 }, 300 }, - { { 600 }, 600 }, - { { 1200 }, 1200 }, + { { 75 }, 75, 1 }, + { { 150 }, 150, 3 }, + { { 300 }, 300, 7 }, + { { 600 }, 600, 14 }, + { { 1200 }, 1200, 28 }, }; for (const CustomSensorSettings& setting : custom_settings) { sensor.resolutions = setting.resolutions; sensor.register_dpiset = setting.register_dpiset; + sensor.output_pixel_offset = setting.output_pixel_offset; s_sensors->push_back(sensor); } } @@ -924,18 +930,20 @@ void genesys_init_sensor_tables() { ValueFilterAny resolutions; unsigned register_dpiset; + unsigned output_pixel_offset; }; CustomSensorSettings custom_settings[] = { - { { 75 }, 75 }, - { { 150 }, 150 }, - { { 300 }, 300 }, - { { 600 }, 600 }, + { { 75 }, 75, 3 }, + { { 150 }, 150, 7 }, + { { 300 }, 300, 14 }, + { { 600 }, 600, 29 }, }; for (const CustomSensorSettings& setting : custom_settings) { sensor.resolutions = setting.resolutions; sensor.register_dpiset = setting.register_dpiset; + sensor.output_pixel_offset = setting.output_pixel_offset; s_sensors->push_back(sensor); } } @@ -979,18 +987,20 @@ void genesys_init_sensor_tables() { ValueFilterAny resolutions; unsigned register_dpiset; + unsigned output_pixel_offset; }; CustomSensorSettings custom_settings[] = { - { { 75 }, 150 }, - { { 150 }, 300 }, - { { 300 }, 600 }, - { { 600 }, 1200 }, + { { 75 }, 150, 3 }, + { { 150 }, 300, 7 }, + { { 300 }, 600, 14 }, + { { 600 }, 1200, 28 }, }; for (const CustomSensorSettings& setting : custom_settings) { sensor.resolutions = setting.resolutions; sensor.register_dpiset = setting.register_dpiset; + sensor.output_pixel_offset = setting.output_pixel_offset; s_sensors->push_back(sensor); } } @@ -1034,18 +1044,20 @@ void genesys_init_sensor_tables() { ValueFilterAny resolutions; unsigned register_dpiset; + unsigned output_pixel_offset; }; CustomSensorSettings custom_settings[] = { - { { 75 }, 150 }, - { { 150 }, 300 }, - { { 300 }, 600 }, - { { 600 }, 600 }, + { { 75 }, 150, 3 }, + { { 150 }, 300, 7 }, + { { 300 }, 600, 14 }, + { { 600 }, 600, 28 }, }; for (const CustomSensorSettings& setting : custom_settings) { sensor.resolutions = setting.resolutions; sensor.register_dpiset = setting.register_dpiset; + sensor.output_pixel_offset = setting.output_pixel_offset; s_sensors->push_back(sensor); } } @@ -1090,18 +1102,20 @@ void genesys_init_sensor_tables() { ValueFilterAny resolutions; unsigned register_dpiset; + unsigned output_pixel_offset; }; CustomSensorSettings custom_settings[] = { - { { 75 }, 75 }, - { { 150 }, 150 }, - { { 300 }, 300 }, - { { 600 }, 600 }, + { { 75 }, 75, 3 }, + { { 150 }, 150, 6 }, + { { 300 }, 300, 13 }, + { { 600 }, 600, 27 }, }; for (const CustomSensorSettings& setting : custom_settings) { sensor.resolutions = setting.resolutions; sensor.register_dpiset = setting.register_dpiset; + sensor.output_pixel_offset = setting.output_pixel_offset; s_sensors->push_back(sensor); } } @@ -3127,16 +3141,17 @@ void genesys_init_sensor_tables() ValueFilterAny resolutions; unsigned register_dpihw; unsigned register_dpiset; + unsigned output_pixel_offset; }; CustomSensorSettings custom_settings[] = { - { { 75 }, 600, 150 }, - { { 100 }, 600, 200 }, - { { 150 }, 600, 300 }, - { { 200 }, 600, 400 }, - { { 300 }, 600, 600 }, - { { 600 }, 600, 1200 }, - { { 1200 }, 1200, 1200 }, + { { 75 }, 600, 150, 11 }, + { { 100 }, 600, 200, 14 }, + { { 150 }, 600, 300, 22 }, + { { 200 }, 600, 400, 29 }, + { { 300 }, 600, 600, 44 }, + { { 600 }, 600, 1200, 88 }, + { { 1200 }, 1200, 1200, 88 }, }; for (const CustomSensorSettings& setting : custom_settings) { @@ -3144,6 +3159,7 @@ void genesys_init_sensor_tables() sensor.register_dpihw = setting.register_dpihw; sensor.register_dpiset = setting.register_dpiset; sensor.shading_resolution = setting.register_dpihw; + sensor.output_pixel_offset = setting.output_pixel_offset; s_sensors->push_back(sensor); } } @@ -3647,16 +3663,17 @@ void genesys_init_sensor_tables() unsigned register_dpiset; unsigned shading_resolution; unsigned shading_factor; + unsigned output_pixel_offset; }; CustomSensorSettings custom_settings[] = { - { { 75 }, 150, 600, 8 }, - { { 100 }, 200, 600, 6 }, - { { 150 }, 300, 600, 4 }, - { { 200 }, 400, 600, 3 }, - { { 300 }, 600, 600, 2 }, - { { 600 }, 1200, 600, 1 }, - { { 1200 }, 1200, 1200, 1 }, + { { 75 }, 150, 600, 8, 2 }, + { { 100 }, 200, 600, 6, 3 }, + { { 150 }, 300, 600, 4, 4 }, + { { 200 }, 400, 600, 3, 6 }, + { { 300 }, 600, 600, 2, 9 }, + { { 600 }, 1200, 600, 1, 17 }, + { { 1200 }, 1200, 1200, 1, 35 }, }; for (const CustomSensorSettings& setting : custom_settings) { @@ -3664,6 +3681,7 @@ void genesys_init_sensor_tables() sensor.register_dpiset = setting.register_dpiset; sensor.shading_resolution = setting.shading_resolution; sensor.shading_factor = setting.shading_factor; + sensor.output_pixel_offset = setting.output_pixel_offset; s_sensors->push_back(sensor); } } From e5c46aee41083d5f1449dad6c1558560f3503755 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Mon, 13 Apr 2020 07:23:39 +0300 Subject: [PATCH 3/7] genesys: Use output_pixel_offset for CCD offsets on gl843 --- backend/genesys/gl843.cpp | 40 +++---- backend/genesys/low.cpp | 6 +- backend/genesys/tables_sensor.cpp | 172 +++++++++++++++++------------- 3 files changed, 109 insertions(+), 109 deletions(-) diff --git a/backend/genesys/gl843.cpp b/backend/genesys/gl843.cpp index f179812a6..2ae985449 100644 --- a/backend/genesys/gl843.cpp +++ b/backend/genesys/gl843.cpp @@ -1969,39 +1969,23 @@ void CommandSetGl843::send_shading_data(Genesys_Device* dev, const Genesys_Senso uint8_t* data, int size) const { DBG_HELPER(dbg); - uint32_t final_size, length, i; + uint32_t final_size, i; uint8_t *buffer; - int count,offset; - uint16_t strpixel, endpixel, startx; + int count; + + unsigned offset = 0; + unsigned length = size; - offset=0; - length=size; if (dev->reg.get8(REG_0x01) & REG_0x01_SHDAREA) { - /* recompute STRPIXEL used shading calibration so we can - * compute offset within data for SHDAREA case */ + offset = dev->session.params.startx * sensor.shading_resolution / + dev->session.params.xres; - // FIXME: the following is likely incorrect - // start coordinate in optical dpi coordinates - startx = sensor.dummy_pixel; - startx = dev->session.pixel_count_ratio.apply(startx); + length = dev->session.output_pixels * sensor.shading_resolution / + dev->session.params.xres; - /* current scan coordinates */ - strpixel = dev->session.pixel_startx; - endpixel = dev->session.pixel_endx; - - if (dev->model->model_id == ModelId::CANON_4400F || - dev->model->model_id == ModelId::CANON_8600F) - { - int half_ccd_factor = dev->session.optical_resolution / sensor.shading_resolution; - strpixel = dev->session.pixel_count_ratio.apply(strpixel / half_ccd_factor); - endpixel = dev->session.pixel_count_ratio.apply(endpixel / half_ccd_factor); - } - - /* 16 bit words, 2 words per color, 3 color channels */ - offset=(strpixel-startx)*2*2*3; - length=(endpixel-strpixel)*2*2*3; - DBG(DBG_info, "%s: STRPIXEL=%d, ENDPIXEL=%d, startx=%d\n", __func__, strpixel, endpixel, - startx); + // 16 bit words, 2 words per color, 3 color channels + length *= 2 * 2 * 3; + offset *= 2 * 2 * 3; } dev->interface->record_key_value("shading_offset", std::to_string(offset)); diff --git a/backend/genesys/low.cpp b/backend/genesys/low.cpp index b87699a05..2524fcc51 100644 --- a/backend/genesys/low.cpp +++ b/backend/genesys/low.cpp @@ -838,10 +838,8 @@ void compute_session_pixel_offsets(const Genesys_Device* dev, ScanSession& s, s.pixel_endx = s.pixel_startx + s.optical_pixels; } else if (dev->model->asic_type == AsicType::GL843) { - unsigned startx = s.params.startx * sensor.optical_res / s.params.xres; - - s.pixel_startx = (startx + sensor.dummy_pixel); - s.pixel_endx = s.pixel_startx + s.optical_pixels; + s.pixel_startx = s.output_startx * sensor.optical_res / s.params.xres; + s.pixel_endx = s.pixel_startx + s.optical_pixels_raw; } else if (dev->model->asic_type == AsicType::GL845 || dev->model->asic_type == AsicType::GL846 || diff --git a/backend/genesys/tables_sensor.cpp b/backend/genesys/tables_sensor.cpp index c38234655..78cd05195 100644 --- a/backend/genesys/tables_sensor.cpp +++ b/backend/genesys/tables_sensor.cpp @@ -1589,21 +1589,23 @@ void genesys_init_sensor_tables() ValueFilterAny resolutions; unsigned register_dpiset; Ratio pixel_count_ratio; + unsigned output_pixel_offset; }; CustomSensorSettings custom_settings[] = { - { { 75 }, 75, Ratio{1, 1} }, - { { 100 }, 100, Ratio{1, 1} }, - { { 150 }, 150, Ratio{1, 1} }, - { { 200 }, 200, Ratio{1, 1} }, - { { 300 }, 300, Ratio{1, 1} }, - { { 600 }, 600, Ratio{1, 1} }, + { { 75 }, 75, Ratio{1, 1}, 4 }, + { { 100 }, 100, Ratio{1, 1}, 6 }, + { { 150 }, 150, Ratio{1, 1}, 9 }, + { { 200 }, 200, Ratio{1, 1}, 12 }, + { { 300 }, 300, Ratio{1, 1}, 19 }, + { { 600 }, 600, Ratio{1, 1}, 38 }, }; for (const CustomSensorSettings& setting : custom_settings) { sensor.resolutions = setting.resolutions; sensor.register_dpiset = setting.register_dpiset; sensor.pixel_count_ratio = setting.pixel_count_ratio; + sensor.output_pixel_offset = setting.output_pixel_offset; s_sensors->push_back(sensor); } } @@ -1631,6 +1633,7 @@ void genesys_init_sensor_tables() int exposure_lperiod; ScanMethod method; Ratio pixel_count_ratio; + unsigned output_pixel_offset; GenesysRegisterSettingSet extra_custom_regs; }; @@ -1705,16 +1708,16 @@ void genesys_init_sensor_tables() }; CustomSensorSettings custom_settings[] = { - { { 100 }, 600, 100, 8016, ScanMethod::FLATBED, Ratio{1, 8}, regs_100_to_600 }, - { { 150 }, 600, 150, 8016, ScanMethod::FLATBED, Ratio{1, 8}, regs_100_to_600 }, - { { 200 }, 600, 200, 8016, ScanMethod::FLATBED, Ratio{1, 8}, regs_100_to_600 }, - { { 300 }, 600, 300, 8016, ScanMethod::FLATBED, Ratio{1, 8}, regs_100_to_600 }, - { { 400 }, 600, 400, 8016, ScanMethod::FLATBED, Ratio{1, 8}, regs_100_to_600 }, - { { 600 }, 600, 600, 8016, ScanMethod::FLATBED, Ratio{1, 8}, regs_100_to_600 }, - { { 1200 }, 1200, 1200, 56064, ScanMethod::FLATBED, Ratio{1, 4}, regs_1200 }, - { { 2400 }, 2400, 2400, 56064, ScanMethod::FLATBED, Ratio{1, 2}, regs_2400 }, - { { 4800 }, 4800, 4800, 42752, ScanMethod::FLATBED, Ratio{1, 1}, regs_4800 }, - { VALUE_FILTER_ANY, 600, 600, 15624, ScanMethod::TRANSPARENCY, Ratio{1, 1}, + { { 100 }, 600, 100, 8016, ScanMethod::FLATBED, Ratio{1, 8}, 1, regs_100_to_600 }, + { { 150 }, 600, 150, 8016, ScanMethod::FLATBED, Ratio{1, 8}, 1, regs_100_to_600 }, + { { 200 }, 600, 200, 8016, ScanMethod::FLATBED, Ratio{1, 8}, 2, regs_100_to_600 }, + { { 300 }, 600, 300, 8016, ScanMethod::FLATBED, Ratio{1, 8}, 3, regs_100_to_600 }, + { { 400 }, 600, 400, 8016, ScanMethod::FLATBED, Ratio{1, 8}, 4, regs_100_to_600 }, + { { 600 }, 600, 600, 8016, ScanMethod::FLATBED, Ratio{1, 8}, 7, regs_100_to_600 }, + { { 1200 }, 1200, 1200, 56064, ScanMethod::FLATBED, Ratio{1, 4}, 14, regs_1200 }, + { { 2400 }, 2400, 2400, 56064, ScanMethod::FLATBED, Ratio{1, 2}, 29, regs_2400 }, + { { 4800 }, 4800, 4800, 42752, ScanMethod::FLATBED, Ratio{1, 1}, 58, regs_4800 }, + { VALUE_FILTER_ANY, 600, 600, 15624, ScanMethod::TRANSPARENCY, Ratio{1, 1}, 58, regs_ta_any } }; @@ -1729,6 +1732,7 @@ void genesys_init_sensor_tables() sensor.exposure_lperiod = setting.exposure_lperiod; sensor.method = setting.method; sensor.pixel_count_ratio = setting.pixel_count_ratio; + sensor.output_pixel_offset = setting.output_pixel_offset; sensor.custom_regs = base_custom_regs; sensor.custom_regs.merge(setting.extra_custom_regs); s_sensors->push_back(sensor); @@ -1757,6 +1761,7 @@ void genesys_init_sensor_tables() int exposure_lperiod; ScanMethod method; Ratio pixel_count_ratio; + unsigned output_pixel_offset; GenesysRegisterSettingSet extra_custom_regs; }; @@ -1827,16 +1832,16 @@ void genesys_init_sensor_tables() }; CustomSensorSettings custom_settings[] = { - { { 100 }, 600, 100, 8016, ScanMethod::FLATBED, Ratio{1, 8}, regs_100_to_600 }, - { { 150 }, 600, 150, 8016, ScanMethod::FLATBED, Ratio{1, 8}, regs_100_to_600 }, - { { 200 }, 600, 200, 8016, ScanMethod::FLATBED, Ratio{1, 8}, regs_100_to_600 }, - { { 300 }, 600, 300, 8016, ScanMethod::FLATBED, Ratio{1, 8}, regs_100_to_600 }, - { { 400 }, 600, 400, 8016, ScanMethod::FLATBED, Ratio{1, 8}, regs_100_to_600 }, - { { 600 }, 600, 600, 8016, ScanMethod::FLATBED, Ratio{1, 8}, regs_100_to_600 }, - { { 1200 }, 1200, 1200, 56064, ScanMethod::FLATBED, Ratio{1, 4}, regs_1200 }, - { { 2400 }, 2400, 2400, 56064, ScanMethod::FLATBED, Ratio{1, 2}, regs_2400 }, - { { 4800 }, 4800, 4800, 42752, ScanMethod::FLATBED, Ratio{1, 1}, regs_4800 }, - { VALUE_FILTER_ANY, 600, 600, 15624, ScanMethod::TRANSPARENCY, Ratio{1, 1}, regs_ta_any } + { { 100 }, 600, 100, 8016, ScanMethod::FLATBED, Ratio{1, 8}, 1, regs_100_to_600 }, + { { 150 }, 600, 150, 8016, ScanMethod::FLATBED, Ratio{1, 8}, 1, regs_100_to_600 }, + { { 200 }, 600, 200, 8016, ScanMethod::FLATBED, Ratio{1, 8}, 2, regs_100_to_600 }, + { { 300 }, 600, 300, 8016, ScanMethod::FLATBED, Ratio{1, 8}, 3, regs_100_to_600 }, + { { 400 }, 600, 400, 8016, ScanMethod::FLATBED, Ratio{1, 8}, 4, regs_100_to_600 }, + { { 600 }, 600, 600, 8016, ScanMethod::FLATBED, Ratio{1, 8}, 7, regs_100_to_600 }, + { { 1200 }, 1200, 1200, 56064, ScanMethod::FLATBED, Ratio{1, 4}, 14, regs_1200 }, + { { 2400 }, 2400, 2400, 56064, ScanMethod::FLATBED, Ratio{1, 2}, 29, regs_2400 }, + { { 4800 }, 4800, 4800, 42752, ScanMethod::FLATBED, Ratio{1, 1}, 58, regs_4800 }, + { VALUE_FILTER_ANY, 600, 600, 15624, ScanMethod::TRANSPARENCY, Ratio{1, 1}, 58, regs_ta_any } }; auto base_custom_regs = sensor.custom_regs; @@ -1849,6 +1854,7 @@ void genesys_init_sensor_tables() sensor.exposure_lperiod = setting.exposure_lperiod; sensor.method = setting.method; sensor.pixel_count_ratio = setting.pixel_count_ratio; + sensor.output_pixel_offset = setting.output_pixel_offset; sensor.custom_regs = base_custom_regs; sensor.custom_regs.merge(setting.extra_custom_regs); s_sensors->push_back(sensor); @@ -1877,13 +1883,14 @@ void genesys_init_sensor_tables() unsigned register_dpiset; int exposure_lperiod; bool use_host_side_calib; + unsigned output_pixel_offset; std::vector methods; GenesysRegisterSettingSet extra_custom_regs; GenesysRegisterSettingSet extra_custom_fe_regs; }; CustomSensorSettings custom_settings[] = { - { { 300 }, 1200, 11640, false, { ScanMethod::FLATBED }, { + { { 300 }, 1200, 11640, false, 1, { ScanMethod::FLATBED }, { { 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x6b }, { 0x52, 0x0a }, { 0x53, 0x0d }, { 0x54, 0x00 }, { 0x55, 0x03 }, @@ -1895,7 +1902,7 @@ void genesys_init_sensor_tables() { 0x9e, 0x2d }, }, {} }, - { { 600 }, 2400, 11640, false, { ScanMethod::FLATBED }, { + { { 600 }, 2400, 11640, false, 2, { ScanMethod::FLATBED }, { { 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x6b }, { 0x52, 0x0a }, { 0x53, 0x0d }, { 0x54, 0x00 }, { 0x55, 0x03 }, @@ -1907,7 +1914,7 @@ void genesys_init_sensor_tables() { 0x9e, 0x2d }, }, {} }, - { { 1200 }, 4800, 11640, false, { ScanMethod::FLATBED }, { + { { 1200 }, 4800, 11640, false, 5, { ScanMethod::FLATBED }, { { 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x6b }, { 0x52, 0x0a }, { 0x53, 0x0d }, { 0x54, 0x00 }, { 0x55, 0x03 }, @@ -1919,7 +1926,7 @@ void genesys_init_sensor_tables() { 0x9e, 0x2d }, }, {} }, - { { 1200 }, 4800, 33300, true, { ScanMethod::TRANSPARENCY }, { + { { 1200 }, 4800, 33300, true, 5, { ScanMethod::TRANSPARENCY }, { { 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x6b }, { 0x52, 0x0a }, { 0x53, 0x0d }, { 0x54, 0x00 }, { 0x55, 0x03 }, @@ -1931,7 +1938,7 @@ void genesys_init_sensor_tables() { 0x9e, 0x2d }, }, {} }, - { { 2400 }, 4800, 33300, true, { ScanMethod::TRANSPARENCY }, { + { { 2400 }, 4800, 33300, true, 10, { ScanMethod::TRANSPARENCY }, { { 0x16, 0x13 }, { 0x17, 0x15 }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x01 }, { 0x1d, 0x75 }, { 0x52, 0x0b }, { 0x53, 0x0d }, { 0x54, 0x00 }, { 0x55, 0x03 }, @@ -1945,7 +1952,7 @@ void genesys_init_sensor_tables() { 0x03, 0x1f }, } }, - { { 4800 }, 4800, 33300, true, { ScanMethod::TRANSPARENCY }, { + { { 4800 }, 4800, 33300, true, 20, { ScanMethod::TRANSPARENCY }, { { 0x16, 0x13 }, { 0x17, 0x15 }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x61 }, { 0x1d, 0x75 }, { 0x52, 0x02 }, { 0x53, 0x05 }, { 0x54, 0x08 }, { 0x55, 0x0b }, @@ -1967,6 +1974,7 @@ void genesys_init_sensor_tables() sensor.register_dpiset = setting.register_dpiset; sensor.shading_resolution = resolution; sensor.exposure_lperiod = setting.exposure_lperiod; + sensor.output_pixel_offset = setting.output_pixel_offset; sensor.use_host_side_calib = setting.use_host_side_calib; sensor.method = method; sensor.custom_regs = setting.extra_custom_regs; @@ -2001,13 +2009,14 @@ void genesys_init_sensor_tables() unsigned register_dpiset; Ratio pixel_count_ratio; int exposure_lperiod; + unsigned output_pixel_offset; std::vector methods; GenesysRegisterSettingSet extra_custom_regs; GenesysRegisterSettingSet custom_fe_regs; }; CustomSensorSettings custom_settings[] = { - { { 400 }, 2400, Ratio{1, 4}, 7200, { ScanMethod::FLATBED }, { + { { 400 }, 2400, Ratio{1, 4}, 7200, 2, { ScanMethod::FLATBED }, { { 0x16, 0x33 }, { 0x17, 0x0c }, { 0x18, 0x13 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x84 }, { 0x1e, 0xa0 }, { 0x52, 0x0d }, { 0x53, 0x10 }, { 0x54, 0x01 }, { 0x55, 0x04 }, @@ -2019,7 +2028,7 @@ void genesys_init_sensor_tables() { 0x80, 0x2a }, }, {} }, - { { 800 }, 4800, Ratio{1, 4}, 7200, { ScanMethod::FLATBED }, { + { { 800 }, 4800, Ratio{1, 4}, 7200, 5, { ScanMethod::FLATBED }, { { 0x16, 0x33 }, { 0x17, 0x0c }, { 0x18, 0x13 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x84 }, { 0x1e, 0xa0 }, { 0x52, 0x0d }, { 0x53, 0x10 }, { 0x54, 0x01 }, { 0x55, 0x04 }, @@ -2031,7 +2040,7 @@ void genesys_init_sensor_tables() { 0x80, 0x20 }, }, {} }, - { { 1600 }, 4800, Ratio{1, 2}, 14400, { ScanMethod::FLATBED }, { + { { 1600 }, 4800, Ratio{1, 2}, 14400, 10, { ScanMethod::FLATBED }, { { 0x16, 0x33 }, { 0x17, 0x0c }, { 0x18, 0x11 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x84 }, { 0x1e, 0xa1 }, { 0x52, 0x0b }, { 0x53, 0x0e }, { 0x54, 0x11 }, { 0x55, 0x02 }, @@ -2045,7 +2054,7 @@ void genesys_init_sensor_tables() { 0x03, 0x1f }, } }, - { { 3200 }, 4800, Ratio{1, 1}, 28800, { ScanMethod::FLATBED }, { + { { 3200 }, 4800, Ratio{1, 1}, 28800, 20, { ScanMethod::FLATBED }, { { 0x16, 0x33 }, { 0x17, 0x0c }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x20 }, { 0x1d, 0x84 }, { 0x1e, 0xa1 }, { 0x52, 0x02 }, { 0x53, 0x05 }, { 0x54, 0x08 }, { 0x55, 0x0b }, @@ -2059,8 +2068,8 @@ void genesys_init_sensor_tables() { 0x03, 0x1f }, }, }, - { { 400 }, 2400, Ratio{1, 4}, 14400, { ScanMethod::TRANSPARENCY, - ScanMethod::TRANSPARENCY_INFRARED }, { + { { 400 }, 2400, Ratio{1, 4}, 14400, 2, { ScanMethod::TRANSPARENCY, + ScanMethod::TRANSPARENCY_INFRARED }, { { 0x16, 0x33 }, { 0x17, 0x0c }, { 0x18, 0x13 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x84 }, { 0x1e, 0xa0 }, { 0x52, 0x0d }, { 0x53, 0x10 }, { 0x54, 0x01 }, { 0x55, 0x04 }, @@ -2072,8 +2081,8 @@ void genesys_init_sensor_tables() { 0x80, 0x20 }, }, {} }, - { { 800 }, 4800, Ratio{1, 4}, 14400, { ScanMethod::TRANSPARENCY, - ScanMethod::TRANSPARENCY_INFRARED }, { + { { 800 }, 4800, Ratio{1, 4}, 14400, 5, { ScanMethod::TRANSPARENCY, + ScanMethod::TRANSPARENCY_INFRARED }, { { 0x16, 0x33 }, { 0x17, 0x0c }, { 0x18, 0x13 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x84 }, { 0x1e, 0xa0 }, { 0x52, 0x0d }, { 0x53, 0x10 }, { 0x54, 0x01 }, { 0x55, 0x04 }, @@ -2085,8 +2094,8 @@ void genesys_init_sensor_tables() { 0x80, 0x20 }, }, {} }, - { { 1600 }, 4800, Ratio{1, 2}, 28800, { ScanMethod::TRANSPARENCY, - ScanMethod::TRANSPARENCY_INFRARED }, { + { { 1600 }, 4800, Ratio{1, 2}, 28800, 10, { ScanMethod::TRANSPARENCY, + ScanMethod::TRANSPARENCY_INFRARED }, { { 0x16, 0x33 }, { 0x17, 0x0c }, { 0x18, 0x11 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x84 }, { 0x1e, 0xa0 }, { 0x52, 0x0b }, { 0x53, 0x0e }, { 0x54, 0x11 }, { 0x55, 0x02 }, @@ -2100,8 +2109,8 @@ void genesys_init_sensor_tables() { 0x03, 0x1f }, }, }, - { { 3200 }, 4800, Ratio{1, 1}, 28800, { ScanMethod::TRANSPARENCY, - ScanMethod::TRANSPARENCY_INFRARED }, { + { { 3200 }, 4800, Ratio{1, 1}, 28800, 20, { ScanMethod::TRANSPARENCY, + ScanMethod::TRANSPARENCY_INFRARED }, { { 0x16, 0x33 }, { 0x17, 0x0c }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x20 }, { 0x1d, 0x84 }, { 0x1e, 0xa0 }, { 0x52, 0x02 }, { 0x53, 0x05 }, { 0x54, 0x08 }, { 0x55, 0x0b }, @@ -2126,6 +2135,7 @@ void genesys_init_sensor_tables() sensor.register_dpiset = setting.register_dpiset; sensor.pixel_count_ratio = setting.pixel_count_ratio; sensor.exposure_lperiod = setting.exposure_lperiod; + sensor.output_pixel_offset = setting.output_pixel_offset; sensor.method = method; sensor.custom_regs = setting.extra_custom_regs; sensor.custom_fe_regs = setting.custom_fe_regs; @@ -2157,13 +2167,14 @@ void genesys_init_sensor_tables() ValueFilterAny resolutions; unsigned register_dpiset; int exposure_lperiod; + unsigned output_pixel_offset; std::vector methods; GenesysRegisterSettingSet extra_custom_regs; GenesysRegisterSettingSet custom_fe_regs; }; CustomSensorSettings custom_settings[] = { - { { 300 }, 1200, 24000, { ScanMethod::FLATBED }, { + { { 300 }, 1200, 24000, 1, { ScanMethod::FLATBED }, { { 0x0c, 0x00 }, { 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x6b }, @@ -2178,7 +2189,7 @@ void genesys_init_sensor_tables() }, {}, }, - { { 600 }, 2400, 24000, { ScanMethod::FLATBED }, { + { { 600 }, 2400, 24000, 2, { ScanMethod::FLATBED }, { { 0x0c, 0x00 }, { 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x6b }, @@ -2193,7 +2204,7 @@ void genesys_init_sensor_tables() }, {}, }, - { { 1200 }, 4800, 24000, { ScanMethod::FLATBED }, { + { { 1200 }, 4800, 24000, 5, { ScanMethod::FLATBED }, { { 0x0c, 0x00 }, { 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x6b }, @@ -2208,8 +2219,8 @@ void genesys_init_sensor_tables() }, {}, }, - { { 300 }, 1200, 45000, { ScanMethod::TRANSPARENCY, - ScanMethod::TRANSPARENCY_INFRARED }, { + { { 300 }, 1200, 45000, 1, { ScanMethod::TRANSPARENCY, + ScanMethod::TRANSPARENCY_INFRARED }, { { 0x0c, 0x00 }, { 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x6b }, @@ -2224,8 +2235,8 @@ void genesys_init_sensor_tables() }, {}, }, - { { 600 }, 2400, 45000, { ScanMethod::TRANSPARENCY, - ScanMethod::TRANSPARENCY_INFRARED }, { + { { 600 }, 2400, 45000, 2, { ScanMethod::TRANSPARENCY, + ScanMethod::TRANSPARENCY_INFRARED }, { { 0x0c, 0x00 }, { 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x6b }, @@ -2240,8 +2251,8 @@ void genesys_init_sensor_tables() }, {}, }, - { { 1200 }, 4800, 45000, { ScanMethod::TRANSPARENCY, - ScanMethod::TRANSPARENCY_INFRARED }, { + { { 1200 }, 4800, 45000, 5, { ScanMethod::TRANSPARENCY, + ScanMethod::TRANSPARENCY_INFRARED }, { { 0x0c, 0x00 }, { 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x6b }, @@ -2256,8 +2267,8 @@ void genesys_init_sensor_tables() }, {}, }, - { { 2400 }, 4800, 45000, { ScanMethod::TRANSPARENCY, - ScanMethod::TRANSPARENCY_INFRARED }, { + { { 2400 }, 4800, 45000, 10, { ScanMethod::TRANSPARENCY, + ScanMethod::TRANSPARENCY_INFRARED }, { { 0x0c, 0x00 }, { 0x16, 0x13 }, { 0x17, 0x15 }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x01 }, { 0x1d, 0x75 }, @@ -2272,8 +2283,8 @@ void genesys_init_sensor_tables() }, {}, }, - { { 4800 }, 4800, 45000, { ScanMethod::TRANSPARENCY, - ScanMethod::TRANSPARENCY_INFRARED }, { + { { 4800 }, 4800, 45000, 20, { ScanMethod::TRANSPARENCY, + ScanMethod::TRANSPARENCY_INFRARED }, { { 0x0c, 0x00 }, { 0x16, 0x13 }, { 0x17, 0x15 }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x61 }, { 0x1d, 0x75 }, @@ -2297,6 +2308,7 @@ void genesys_init_sensor_tables() sensor.resolutions = { resolution }; sensor.register_dpiset = setting.register_dpiset; sensor.shading_resolution = resolution; + sensor.output_pixel_offset = setting.output_pixel_offset; sensor.method = method; sensor.exposure_lperiod = setting.exposure_lperiod; sensor.custom_regs = setting.extra_custom_regs; @@ -3215,25 +3227,26 @@ void genesys_init_sensor_tables() unsigned ccd_size_divisor; unsigned shading_resolution; Ratio pixel_count_ratio; + unsigned output_pixel_offset; unsigned exposure_lperiod; unsigned register_dpiset; GenesysRegisterSettingSet custom_fe_regs; }; CustomSensorSettings custom_settings[] = { - { { 900 }, ScanMethod::TRANSPARENCY, 1, 900, Ratio{8, 8}, 0x2538, 150, {} }, - { { 1800 }, ScanMethod::TRANSPARENCY, 1, 1800, Ratio{4, 4}, 0x2538, 300, {} }, - { { 3600 }, ScanMethod::TRANSPARENCY, 1, 3600, Ratio{2, 2}, 0x2538, 600, {} }, - { { 7200 }, ScanMethod::TRANSPARENCY, 1, 7200, Ratio{1, 1}, 0x19c8, 1200, { + { { 900 }, ScanMethod::TRANSPARENCY, 1, 900, Ratio{8, 8}, 2, 0x2538, 150, {} }, + { { 1800 }, ScanMethod::TRANSPARENCY, 1, 1800, Ratio{4, 4}, 5, 0x2538, 300, {} }, + { { 3600 }, ScanMethod::TRANSPARENCY, 1, 3600, Ratio{2, 2}, 10, 0x2538, 600, {} }, + { { 7200 }, ScanMethod::TRANSPARENCY, 1, 7200, Ratio{1, 1}, 20, 0x19c8, 1200, { { 0x02, 0x1b }, { 0x03, 0x14 }, { 0x04, 0x20 }, } }, - { { 900 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 900, Ratio{8, 8}, 0x1f54, 150, {} }, - { { 1800 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 1800, Ratio{4, 4}, 0x1f54, 300, {} }, - { { 3600 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 3600, Ratio{2, 2}, 0x1f54, 600, {} }, - { { 7200 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 7200, Ratio{1, 1}, 0x1f54, 1200, {} }, + { { 900 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 900, Ratio{8, 8}, 2, 0x1f54, 150, {} }, + { { 1800 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 1800, Ratio{4, 4}, 5, 0x1f54, 300, {} }, + { { 3600 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 3600, Ratio{2, 2}, 10, 0x1f54, 600, {} }, + { { 7200 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 7200, Ratio{1, 1}, 20, 0x1f54, 1200, {} }, }; for (const CustomSensorSettings& setting : custom_settings) { @@ -3242,6 +3255,7 @@ void genesys_init_sensor_tables() sensor.shading_resolution = setting.shading_resolution; sensor.ccd_size_divisor = setting.ccd_size_divisor; sensor.pixel_count_ratio = setting.pixel_count_ratio; + sensor.output_pixel_offset = setting.output_pixel_offset; sensor.exposure_lperiod = setting.exposure_lperiod; sensor.register_dpiset = setting.register_dpiset; sensor.custom_fe_regs = setting.custom_fe_regs; @@ -3302,14 +3316,15 @@ void genesys_init_sensor_tables() unsigned ccd_size_divisor; unsigned shading_resolution; Ratio pixel_count_ratio; + unsigned output_pixel_offset; unsigned register_dpiset; }; CustomSensorSettings custom_settings[] = { - { { 900 }, 1, 900, Ratio{8, 8}, 150 }, - { { 1800 }, 1, 1800, Ratio{4, 4}, 300 }, - { { 3600 }, 1, 3600, Ratio{2, 2}, 600 }, - { { 7200 }, 1, 7200, Ratio{1, 1}, 1200 }, + { { 900 }, 1, 900, Ratio{8, 8}, 2, 150 }, + { { 1800 }, 1, 1800, Ratio{4, 4}, 5, 300 }, + { { 3600 }, 1, 3600, Ratio{2, 2}, 10, 600 }, + { { 7200 }, 1, 7200, Ratio{1, 1}, 20, 1200 }, }; for (const CustomSensorSettings& setting : custom_settings) { @@ -3317,6 +3332,7 @@ void genesys_init_sensor_tables() sensor.ccd_size_divisor = setting.ccd_size_divisor; sensor.shading_resolution = setting.shading_resolution; sensor.pixel_count_ratio = setting.pixel_count_ratio; + sensor.output_pixel_offset = setting.output_pixel_offset; sensor.register_dpiset = setting.register_dpiset; s_sensors->push_back(sensor); } @@ -3425,19 +3441,20 @@ void genesys_init_sensor_tables() unsigned ccd_size_divisor; unsigned shading_resolution; Ratio pixel_count_ratio; + unsigned output_pixel_offset; unsigned exposure_lperiod; unsigned register_dpiset; }; CustomSensorSettings custom_settings[] = { - { { 900 }, ScanMethod::TRANSPARENCY, 1, 900, Ratio{8, 8}, 0x2f44, 150 }, - { { 1800 }, ScanMethod::TRANSPARENCY, 1, 1800, Ratio{4, 4}, 0x2f44, 300 }, - { { 3600 }, ScanMethod::TRANSPARENCY, 1, 3600, Ratio{2, 2}, 0x2f44, 600 }, - { { 7200 }, ScanMethod::TRANSPARENCY, 1, 7200, Ratio{1, 1}, 0x2f44, 1200 }, - { { 900 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 900, Ratio{8, 8}, 0x2af8, 150 }, - { { 1800 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 1800, Ratio{4, 4}, 0x2af8, 300 }, - { { 3600 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 3600, Ratio{2, 2}, 0x2af8, 600 }, - { { 7200 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 7200, Ratio{1, 1}, 0x2af8, 1200 }, + { { 900 }, ScanMethod::TRANSPARENCY, 1, 900, Ratio{8, 8}, 2, 0x2f44, 150 }, + { { 1800 }, ScanMethod::TRANSPARENCY, 1, 1800, Ratio{4, 4}, 5, 0x2f44, 300 }, + { { 3600 }, ScanMethod::TRANSPARENCY, 1, 3600, Ratio{2, 2}, 10, 0x2f44, 600 }, + { { 7200 }, ScanMethod::TRANSPARENCY, 1, 7200, Ratio{1, 1}, 20, 0x2f44, 1200 }, + { { 900 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 900, Ratio{8, 8}, 2, 0x2af8, 150 }, + { { 1800 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 1800, Ratio{4, 4}, 5, 0x2af8, 300 }, + { { 3600 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 3600, Ratio{2, 2}, 10, 0x2af8, 600 }, + { { 7200 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 7200, Ratio{1, 1}, 20, 0x2af8, 1200 }, }; for (const CustomSensorSettings& setting : custom_settings) { @@ -3446,6 +3463,7 @@ void genesys_init_sensor_tables() sensor.ccd_size_divisor = setting.ccd_size_divisor; sensor.shading_resolution = setting.shading_resolution; sensor.pixel_count_ratio = setting.pixel_count_ratio; + sensor.output_pixel_offset = setting.output_pixel_offset; sensor.exposure_lperiod = setting.exposure_lperiod; sensor.register_dpiset = setting.register_dpiset; s_sensors->push_back(sensor); From eca7a5ab91ef24fb172ffc683be4dcae1eeb5128 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Mon, 13 Apr 2020 07:23:40 +0300 Subject: [PATCH 4/7] genesys: Use output_pixel_offset for CCD offsets on gl845/gl846 --- backend/genesys/gl846.cpp | 32 ++++++++++++------------------- backend/genesys/low.cpp | 10 +++++----- backend/genesys/tables_sensor.cpp | 30 ++++++++++++++++------------- 3 files changed, 34 insertions(+), 38 deletions(-) diff --git a/backend/genesys/gl846.cpp b/backend/genesys/gl846.cpp index fe4635104..b935e476a 100644 --- a/backend/genesys/gl846.cpp +++ b/backend/genesys/gl846.cpp @@ -1012,29 +1012,21 @@ void CommandSetGl846::send_shading_data(Genesys_Device* dev, const Genesys_Senso uint8_t* data, int size) const { DBG_HELPER_ARGS(dbg, "writing %d bytes of shading data", size); - std::uint32_t addr, length, i, pixels; + std::uint32_t addr, i; uint8_t val,*ptr,*src; - /* shading data is plit in 3 (up to 5 with IR) areas - write(0x10014000,0x00000dd8) - URB 23429 bulk_out len 3544 wrote 0x33 0x10 0x.... - write(0x1003e000,0x00000dd8) - write(0x10068000,0x00000dd8) - */ - length = static_cast(size / 3); - unsigned strpixel = dev->session.pixel_startx; - unsigned endpixel = dev->session.pixel_endx; + unsigned length = static_cast(size / 3); - pixels=endpixel-strpixel; + // we're using SHDAREA, thus we only need to upload part of the line + unsigned offset = dev->session.pixel_count_ratio.apply( + dev->session.params.startx * sensor.optical_res / dev->session.params.xres); + unsigned pixels = dev->session.pixel_count_ratio.apply(dev->session.optical_pixels_raw); - /* since we're using SHDAREA, substract startx coordinate from shading */ - strpixel -= (sensor.ccd_start_xoffset * 600) / sensor.optical_res; + // turn pixel value into bytes 2x16 bits words + offset *= 2 * 2; + pixels *= 2 * 2; - /* turn pixel value into bytes 2x16 bits words */ - strpixel*=2*2; - pixels*=2*2; - - dev->interface->record_key_value("shading_offset", std::to_string(strpixel)); + dev->interface->record_key_value("shading_offset", std::to_string(offset)); dev->interface->record_key_value("shading_pixels", std::to_string(pixels)); dev->interface->record_key_value("shading_length", std::to_string(length)); dev->interface->record_key_value("shading_factor", std::to_string(sensor.shading_factor)); @@ -1055,8 +1047,8 @@ void CommandSetGl846::send_shading_data(Genesys_Device* dev, const Genesys_Senso /* iterate on both sensor segment */ for (unsigned x = 0; x < pixels; x += 4 * sensor.shading_factor) { - /* coefficient source */ - src=(data+strpixel+i*length)+x; + // coefficient source + src = (data + offset + i * length) + x; /* coefficient copy */ ptr[0]=src[0]; diff --git a/backend/genesys/low.cpp b/backend/genesys/low.cpp index 2524fcc51..4a3150f44 100644 --- a/backend/genesys/low.cpp +++ b/backend/genesys/low.cpp @@ -837,14 +837,14 @@ void compute_session_pixel_offsets(const Genesys_Device* dev, ScanSession& s, s.pixel_startx = (s.output_startx * s.optical_resolution) / s.params.xres; s.pixel_endx = s.pixel_startx + s.optical_pixels; - } else if (dev->model->asic_type == AsicType::GL843) { + } else if (dev->model->asic_type == AsicType::GL843 || + dev->model->asic_type == AsicType::GL845 || + dev->model->asic_type == AsicType::GL846) + { s.pixel_startx = s.output_startx * sensor.optical_res / s.params.xres; s.pixel_endx = s.pixel_startx + s.optical_pixels_raw; - } else if (dev->model->asic_type == AsicType::GL845 || - dev->model->asic_type == AsicType::GL846 || - dev->model->asic_type == AsicType::GL847) - { + } else if (dev->model->asic_type == AsicType::GL847) { unsigned startx = s.params.startx * sensor.optical_res / s.params.xres; s.pixel_startx = startx; diff --git a/backend/genesys/tables_sensor.cpp b/backend/genesys/tables_sensor.cpp index 78cd05195..263d872df 100644 --- a/backend/genesys/tables_sensor.cpp +++ b/backend/genesys/tables_sensor.cpp @@ -3372,20 +3372,22 @@ void genesys_init_sensor_tables() { ValueFilterAny resolutions; unsigned register_dpiset; + unsigned output_pixel_offset; }; CustomSensorSettings custom_settings[] = { - { { 600 }, 100 }, - { { 1200 }, 200 }, - { { 2400 }, 400 }, - { { 3600 }, 600 }, - { { 7200 }, 1200 }, + { { 600 }, 100, 10 }, + { { 1200 }, 200, 20 }, + { { 2400 }, 400, 40 }, + { { 3600 }, 600, 60 }, + { { 7200 }, 1200, 120 }, }; for (const CustomSensorSettings& setting : custom_settings) { sensor.resolutions = setting.resolutions; sensor.shading_resolution = setting.resolutions.values()[0]; sensor.register_dpiset = setting.register_dpiset; + sensor.output_pixel_offset = setting.output_pixel_offset; s_sensors->push_back(sensor); } } @@ -3505,17 +3507,18 @@ void genesys_init_sensor_tables() ValueFilterAny resolutions; ScanMethod method; unsigned register_dpiset; + unsigned output_pixel_offset; }; CustomSensorSettings custom_settings[] = { - { { 900 }, ScanMethod::TRANSPARENCY, 150 }, - { { 1800 }, ScanMethod::TRANSPARENCY, 300 }, - { { 3600 }, ScanMethod::TRANSPARENCY, 600 }, - { { 7200 }, ScanMethod::TRANSPARENCY, 1200 }, - { { 900 }, ScanMethod::TRANSPARENCY_INFRARED, 150 }, - { { 1800 }, ScanMethod::TRANSPARENCY_INFRARED, 300 }, - { { 3600 }, ScanMethod::TRANSPARENCY_INFRARED, 600 }, - { { 7200 }, ScanMethod::TRANSPARENCY_INFRARED, 1200 }, + { { 900 }, ScanMethod::TRANSPARENCY, 150, 15 }, + { { 1800 }, ScanMethod::TRANSPARENCY, 300, 30 }, + { { 3600 }, ScanMethod::TRANSPARENCY, 600, 60 }, + { { 7200 }, ScanMethod::TRANSPARENCY, 1200, 120 }, + { { 900 }, ScanMethod::TRANSPARENCY_INFRARED, 150, 15 }, + { { 1800 }, ScanMethod::TRANSPARENCY_INFRARED, 300, 30 }, + { { 3600 }, ScanMethod::TRANSPARENCY_INFRARED, 600, 60 }, + { { 7200 }, ScanMethod::TRANSPARENCY_INFRARED, 1200, 120 }, }; for (const CustomSensorSettings& setting : custom_settings) { @@ -3523,6 +3526,7 @@ void genesys_init_sensor_tables() sensor.method = setting.method; sensor.shading_resolution = setting.resolutions.values()[0]; sensor.register_dpiset = setting.register_dpiset; + sensor.output_pixel_offset = setting.output_pixel_offset; s_sensors->push_back(sensor); } } From bae938b4be6d74659201a68d40b0977df45de1d9 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Mon, 13 Apr 2020 07:23:41 +0300 Subject: [PATCH 5/7] genesys: Use output_pixel_offset for CCD offsets on gl847 --- backend/genesys/gl847.cpp | 30 ++++------ backend/genesys/low.cpp | 13 +---- backend/genesys/tables_sensor.cpp | 92 +++++++++++++++++++------------ 3 files changed, 70 insertions(+), 65 deletions(-) diff --git a/backend/genesys/gl847.cpp b/backend/genesys/gl847.cpp index 92f88c258..7ca7c4b28 100644 --- a/backend/genesys/gl847.cpp +++ b/backend/genesys/gl847.cpp @@ -880,29 +880,21 @@ void CommandSetGl847::send_shading_data(Genesys_Device* dev, const Genesys_Senso uint8_t* data, int size) const { DBG_HELPER_ARGS(dbg, "writing %d bytes of shading data", size); - std::uint32_t addr, length, i, pixels; + std::uint32_t addr, i; uint8_t val,*ptr,*src; - /* shading data is plit in 3 (up to 5 with IR) areas - write(0x10014000,0x00000dd8) - URB 23429 bulk_out len 3544 wrote 0x33 0x10 0x.... - write(0x1003e000,0x00000dd8) - write(0x10068000,0x00000dd8) - */ - length = static_cast(size / 3); - std::uint32_t strpixel = dev->session.pixel_startx; - std::uint32_t endpixel = dev->session.pixel_endx; + unsigned length = static_cast(size / 3); - pixels=endpixel-strpixel; + // we're using SHDAREA, thus we only need to upload part of the line + unsigned offset = dev->session.pixel_count_ratio.apply( + dev->session.params.startx * sensor.optical_res / dev->session.params.xres); + unsigned pixels = dev->session.pixel_count_ratio.apply(dev->session.optical_pixels_raw); - /* since we're using SHDAREA, substract startx coordinate from shading */ - strpixel -= (sensor.ccd_start_xoffset * 600) / sensor.optical_res; + // turn pixel value into bytes 2x16 bits words + offset *= 2 * 2; + pixels *= 2 * 2; - /* turn pixel value into bytes 2x16 bits words */ - strpixel*=2*2; - pixels*=2*2; - - dev->interface->record_key_value("shading_offset", std::to_string(strpixel)); + dev->interface->record_key_value("shading_offset", std::to_string(offset)); dev->interface->record_key_value("shading_pixels", std::to_string(pixels)); dev->interface->record_key_value("shading_length", std::to_string(length)); dev->interface->record_key_value("shading_factor", std::to_string(sensor.shading_factor)); @@ -924,7 +916,7 @@ void CommandSetGl847::send_shading_data(Genesys_Device* dev, const Genesys_Senso // iterate on both sensor segment for (unsigned x = 0; x < pixels; x += 4 * sensor.shading_factor) { /* coefficient source */ - src=(data+strpixel+i*length)+x; + src = (data + offset + i * length) + x; /* coefficient copy */ ptr[0]=src[0]; diff --git a/backend/genesys/low.cpp b/backend/genesys/low.cpp index 4a3150f44..3e380729a 100644 --- a/backend/genesys/low.cpp +++ b/backend/genesys/low.cpp @@ -827,8 +827,6 @@ void compute_session_pipeline(const Genesys_Device* dev, ScanSession& s) void compute_session_pixel_offsets(const Genesys_Device* dev, ScanSession& s, const Genesys_Sensor& sensor) { - unsigned ccd_pixels_per_system_pixel = sensor.ccd_pixels_per_system_pixel(); - if (dev->model->asic_type == AsicType::GL646) { s.pixel_startx += s.output_startx * sensor.optical_res / s.params.xres; s.pixel_endx = s.pixel_startx + s.optical_pixels * s.ccd_size_divisor; @@ -839,19 +837,12 @@ void compute_session_pixel_offsets(const Genesys_Device* dev, ScanSession& s, } else if (dev->model->asic_type == AsicType::GL843 || dev->model->asic_type == AsicType::GL845 || - dev->model->asic_type == AsicType::GL846) + dev->model->asic_type == AsicType::GL846 || + dev->model->asic_type == AsicType::GL847) { s.pixel_startx = s.output_startx * sensor.optical_res / s.params.xres; s.pixel_endx = s.pixel_startx + s.optical_pixels_raw; - } else if (dev->model->asic_type == AsicType::GL847) { - unsigned startx = s.params.startx * sensor.optical_res / s.params.xres; - - s.pixel_startx = startx; - - s.pixel_startx += sensor.ccd_start_xoffset * ccd_pixels_per_system_pixel; - s.pixel_endx = s.pixel_startx + s.optical_pixels_raw; - } else if (dev->model->asic_type == AsicType::GL124) { unsigned startx = s.params.startx * sensor.optical_res / s.params.xres; diff --git a/backend/genesys/tables_sensor.cpp b/backend/genesys/tables_sensor.cpp index 263d872df..3f67b3f96 100644 --- a/backend/genesys/tables_sensor.cpp +++ b/backend/genesys/tables_sensor.cpp @@ -1141,6 +1141,7 @@ void genesys_init_sensor_tables() SensorExposure exposure; Ratio pixel_count_ratio; unsigned shading_factor; + unsigned output_pixel_offset; unsigned segment_size; std::vector segment_order; GenesysRegisterSettingSet custom_regs; @@ -1148,7 +1149,7 @@ void genesys_init_sensor_tables() CustomSensorSettings custom_settings[] = { // Note: Windows driver uses 1424 lperiod and enables dummy line (0x17) - { { 75 }, 600, 2848, { 304, 203, 180 }, Ratio{1, 8}, 8, 5136, + { { 75 }, 600, 2848, { 304, 203, 180 }, Ratio{1, 8}, 8, 40, 5136, std::vector{}, { { 0x16, 0x10 }, { 0x17, 0x0a }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, @@ -1160,7 +1161,7 @@ void genesys_init_sensor_tables() } }, // Note: Windows driver uses 1424 lperiod and enables dummy line (0x17) - { { 100 }, 600, 2848, { 304, 203, 180 }, Ratio{1, 8}, 6, 5136, + { { 100 }, 600, 2848, { 304, 203, 180 }, Ratio{1, 8}, 6, 53, 5136, std::vector{}, { { 0x16, 0x10 }, { 0x17, 0x0a }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, @@ -1172,7 +1173,7 @@ void genesys_init_sensor_tables() } }, // Note: Windows driver uses 1424 lperiod and enables dummy line (0x17) - { { 150 }, 600, 2848, { 304, 203, 180 }, Ratio{1, 8}, 4, 5136, + { { 150 }, 600, 2848, { 304, 203, 180 }, Ratio{1, 8}, 4, 80, 5136, std::vector{}, { { 0x16, 0x10 }, { 0x17, 0x0a }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, @@ -1184,7 +1185,7 @@ void genesys_init_sensor_tables() } }, // Note: Windows driver uses 1424 lperiod and enables dummy line (0x17) - { { 200 }, 600, 2848, { 304, 203, 180 }, Ratio{1, 8}, 3, 5136, + { { 200 }, 600, 2848, { 304, 203, 180 }, Ratio{1, 8}, 3, 106, 5136, std::vector{}, { { 0x16, 0x10 }, { 0x17, 0x0a }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, @@ -1196,7 +1197,7 @@ void genesys_init_sensor_tables() } }, // Note: Windows driver uses 788 lperiod and enables dummy line (0x17) - { { 300 }, 600, 1424, { 304, 203, 180 }, Ratio{1, 8}, 2, 5136, + { { 300 }, 600, 1424, { 304, 203, 180 }, Ratio{1, 8}, 2, 160, 5136, std::vector{}, { { 0x16, 0x10 }, { 0x17, 0x0a }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, @@ -1208,7 +1209,7 @@ void genesys_init_sensor_tables() } }, // Note: Windows driver uses 788 lperiod and enables dummy line (0x17) - { { 400 }, 600, 1424, { 304, 203, 180 }, Ratio{1, 8}, 1, 5136, + { { 400 }, 600, 1424, { 304, 203, 180 }, Ratio{1, 8}, 1, 213, 5136, std::vector{}, { { 0x16, 0x10 }, { 0x17, 0x0a }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, @@ -1219,7 +1220,7 @@ void genesys_init_sensor_tables() { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, } }, - { { 600 }, 600, 1432, { 492, 326, 296 }, Ratio{1, 8}, 1, 5136, + { { 600 }, 600, 1432, { 492, 326, 296 }, Ratio{1, 8}, 1, 320, 5136, std::vector{}, { { 0x16, 0x10 }, { 0x17, 0x0a }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, @@ -1230,7 +1231,7 @@ void genesys_init_sensor_tables() { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, } }, - { { 1200 }, 1200, 2712, { 935, 592, 538 }, Ratio{1, 8}, 1, 5136, + { { 1200 }, 1200, 2712, { 935, 592, 538 }, Ratio{1, 8}, 1, 640, 5136, { 0, 1 }, { { 0x16, 0x10 }, { 0x17, 0x08 }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, @@ -1241,7 +1242,7 @@ void genesys_init_sensor_tables() { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, } }, - { { 2400 }, 2400, 5280, { 1777, 1125, 979 }, Ratio{1, 8}, 1, 5136, + { { 2400 }, 2400, 5280, { 1777, 1125, 979 }, Ratio{1, 8}, 1, 1280, 5136, { 0, 2, 1, 3 }, { { 0x16, 0x10 }, { 0x17, 0x06 }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, @@ -1252,7 +1253,7 @@ void genesys_init_sensor_tables() { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, } }, - { { 4800 }, 4800, 10416, { 3377, 2138, 1780 }, Ratio{1, 8}, 1, 5136, + { { 4800 }, 4800, 10416, { 3377, 2138, 1780 }, Ratio{1, 8}, 1, 2560, 5136, { 0, 2, 4, 6, 1, 3, 5, 7 }, { { 0x16, 0x10 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, @@ -1274,6 +1275,7 @@ void genesys_init_sensor_tables() sensor.exposure = setting.exposure; sensor.pixel_count_ratio = setting.pixel_count_ratio; sensor.shading_factor = setting.shading_factor; + sensor.output_pixel_offset = setting.output_pixel_offset; sensor.segment_size = setting.segment_size; sensor.segment_order = setting.segment_order; sensor.custom_regs = setting.custom_regs; @@ -1302,13 +1304,15 @@ void genesys_init_sensor_tables() SensorExposure exposure; Ratio pixel_count_ratio; unsigned shading_factor; + unsigned output_pixel_offset; unsigned segment_size; std::vector segment_order; GenesysRegisterSettingSet custom_regs; }; CustomSensorSettings custom_settings[] = { - { { 75 }, 600, 2848, { 465, 310, 239 }, Ratio{1, 8}, 8, 5187, std::vector{}, { + { { 75 }, 600, 2848, { 465, 310, 239 }, Ratio{1, 8}, 8, 48, 5187, + std::vector{}, { { 0x16, 0x10 }, { 0x17, 0x0c }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, { 0x52, 0x07 }, { 0x53, 0x03 }, { 0x54, 0x00 }, { 0x55, 0x00 }, @@ -1318,7 +1322,8 @@ void genesys_init_sensor_tables() { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, } }, - { { 100 }, 600, 2848, { 465, 310, 239 }, Ratio{1, 8}, 6, 5187, std::vector{}, { + { { 100 }, 600, 2848, { 465, 310, 239 }, Ratio{1, 8}, 6, 64, 5187, + std::vector{}, { { 0x16, 0x10 }, { 0x17, 0x0c }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, { 0x52, 0x07 }, { 0x53, 0x03 }, { 0x54, 0x00 }, { 0x55, 0x00 }, @@ -1328,7 +1333,8 @@ void genesys_init_sensor_tables() { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, } }, - { { 150 }, 600, 2848, { 465, 310, 239 }, Ratio{1, 8}, 4, 5187, std::vector{}, { + { { 150 }, 600, 2848, { 465, 310, 239 }, Ratio{1, 8}, 4, 96, 5187, + std::vector{}, { { 0x16, 0x10 }, { 0x17, 0x0c }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, { 0x52, 0x07 }, { 0x53, 0x03 }, { 0x54, 0x00 }, { 0x55, 0x00 }, @@ -1338,7 +1344,8 @@ void genesys_init_sensor_tables() { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, } }, - { { 200 }, 600, 2848, { 465, 310, 239 }, Ratio{1, 8}, 3, 5187, std::vector{}, { + { { 200 }, 600, 2848, { 465, 310, 239 }, Ratio{1, 8}, 3, 128, 5187, + std::vector{}, { { 0x16, 0x10 }, { 0x17, 0x0c }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, { 0x52, 0x07 }, { 0x53, 0x03 }, { 0x54, 0x00 }, { 0x55, 0x00 }, @@ -1348,7 +1355,8 @@ void genesys_init_sensor_tables() { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, } }, - { { 300 }, 600, 1424, { 465, 310, 239 }, Ratio{1, 8}, 2, 5187, std::vector{}, { + { { 300 }, 600, 1424, { 465, 310, 239 }, Ratio{1, 8}, 2, 192, 5187, + std::vector{}, { { 0x16, 0x10 }, { 0x17, 0x0c }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, { 0x52, 0x07 }, { 0x53, 0x03 }, { 0x54, 0x00 }, { 0x55, 0x00 }, @@ -1358,7 +1366,8 @@ void genesys_init_sensor_tables() { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, } }, - { { 600 }, 600, 1504, { 465, 310, 239 }, Ratio{1, 8}, 1, 5187, std::vector{}, { + { { 600 }, 600, 1504, { 465, 310, 239 }, Ratio{1, 8}, 1, 384, 5187, + std::vector{}, { { 0x16, 0x10 }, { 0x17, 0x0c }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, { 0x52, 0x07 }, { 0x53, 0x03 }, { 0x54, 0x00 }, { 0x55, 0x00 }, @@ -1368,7 +1377,8 @@ void genesys_init_sensor_tables() { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, } }, - { { 1200 }, 1200, 2696, { 1464, 844, 555 }, Ratio{1, 8}, 1, 5187, { 0, 1 }, { + { { 1200 }, 1200, 2696, { 1464, 844, 555 }, Ratio{1, 8}, 1, 768, 5187, + { 0, 1 }, { { 0x16, 0x10 }, { 0x17, 0x0a }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, { 0x52, 0x07 }, { 0x53, 0x03 }, { 0x54, 0x00 }, { 0x55, 0x00 }, @@ -1378,7 +1388,8 @@ void genesys_init_sensor_tables() { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, } }, - { { 2400 }, 2400, 10576, { 2798, 1558, 972 }, Ratio{1, 8}, 1, 5187, { 0, 1, 2, 3 }, { + { { 2400 }, 2400, 10576, { 2798, 1558, 972 }, Ratio{1, 8}, 1, 1536, 5187, + { 0, 1, 2, 3 }, { { 0x16, 0x10 }, { 0x17, 0x08 }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, { 0x52, 0x07 }, { 0x53, 0x03 }, { 0x54, 0x00 }, { 0x55, 0x00 }, @@ -1388,7 +1399,7 @@ void genesys_init_sensor_tables() { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, } }, - { { 4800 }, 4800, 10576, { 2798, 1558, 972 }, Ratio{1, 8}, 1, 5187, + { { 4800 }, 4800, 10576, { 2798, 1558, 972 }, Ratio{1, 8}, 1, 3072, 5187, { 0, 1, 4, 5, 2, 3, 6, 7 }, { { 0x16, 0x10 }, { 0x17, 0x06 }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, @@ -1410,6 +1421,7 @@ void genesys_init_sensor_tables() sensor.exposure = setting.exposure; sensor.pixel_count_ratio = setting.pixel_count_ratio; sensor.shading_factor = setting.shading_factor; + sensor.output_pixel_offset = setting.output_pixel_offset; sensor.segment_size = setting.segment_size; sensor.segment_order = setting.segment_order; sensor.custom_regs = setting.custom_regs; @@ -1438,13 +1450,15 @@ void genesys_init_sensor_tables() SensorExposure exposure; Ratio pixel_count_ratio; unsigned shading_factor; + unsigned output_pixel_offset; unsigned segment_size; std::vector segment_order; GenesysRegisterSettingSet custom_regs; }; CustomSensorSettings custom_settings[] = { - { { 75 }, 600, 2304, { 423, 294, 242 }, Ratio{1, 4}, 8, 5136, std::vector{}, { + { { 75 }, 600, 2304, { 423, 294, 242 }, Ratio{1, 4}, 8, 40, 5136, + std::vector{}, { { 0x16, 0x10 }, { 0x17, 0x0a }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, { 0x52, 0x03 }, { 0x53, 0x07 }, { 0x54, 0x00 }, { 0x55, 0x00 }, @@ -1454,7 +1468,8 @@ void genesys_init_sensor_tables() { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, } }, - { { 100 }, 600, 2304, { 423, 294, 242 }, Ratio{1, 4}, 6, 5136, std::vector{}, { + { { 100 }, 600, 2304, { 423, 294, 242 }, Ratio{1, 4}, 6, 53, 5136, + std::vector{}, { { 0x16, 0x10 }, { 0x17, 0x0a }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, { 0x52, 0x03 }, { 0x53, 0x07 }, { 0x54, 0x00 }, { 0x55, 0x00 }, @@ -1464,7 +1479,8 @@ void genesys_init_sensor_tables() { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, } }, - { { 150 }, 600, 2304, { 423, 294, 242 }, Ratio{1, 4}, 4, 5136, std::vector{}, { + { { 150 }, 600, 2304, { 423, 294, 242 }, Ratio{1, 4}, 4, 80, 5136, + std::vector{}, { { 0x16, 0x10 }, { 0x17, 0x0a }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, { 0x52, 0x03 }, { 0x53, 0x07 }, { 0x54, 0x00 }, { 0x55, 0x00 }, @@ -1474,7 +1490,8 @@ void genesys_init_sensor_tables() { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, } }, - { { 200 }, 600, 2304, { 423, 294, 242 }, Ratio{1, 4}, 3, 5136, std::vector{}, { + { { 200 }, 600, 2304, { 423, 294, 242 }, Ratio{1, 4}, 3, 106, 5136, + std::vector{}, { { 0x16, 0x10 }, { 0x17, 0x0a }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, { 0x52, 0x03 }, { 0x53, 0x07 }, { 0x54, 0x00 }, { 0x55, 0x00 }, @@ -1484,7 +1501,8 @@ void genesys_init_sensor_tables() { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, } }, - { { 300 }, 600, 1728, { 423, 294, 242 }, Ratio{1, 4}, 2, 5136, std::vector{}, { + { { 300 }, 600, 1728, { 423, 294, 242 }, Ratio{1, 4}, 2, 160, 5136, + std::vector{}, { { 0x16, 0x10 }, { 0x17, 0x0a }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, { 0x52, 0x03 }, { 0x53, 0x07 }, { 0x54, 0x00 }, { 0x55, 0x00 }, @@ -1494,7 +1512,8 @@ void genesys_init_sensor_tables() { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, } }, - { { 600 }, 600, 1432, { 423, 294, 242 }, Ratio{1, 4}, 1, 5136, std::vector{}, { + { { 600 }, 600, 1432, { 423, 294, 242 }, Ratio{1, 4}, 1, 320, 5136, + std::vector{}, { { 0x16, 0x10 }, { 0x17, 0x0a }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, { 0x52, 0x03 }, { 0x53, 0x07 }, { 0x54, 0x00 }, { 0x55, 0x00 }, @@ -1504,7 +1523,7 @@ void genesys_init_sensor_tables() { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, }, }, - { { 1200 }, 1200, 2712, { 791, 542, 403 }, Ratio{1, 4}, 1, 5136, {0, 1}, { + { { 1200 }, 1200, 2712, { 791, 542, 403 }, Ratio{1, 4}, 1, 640, 5136, {0, 1}, { { 0x16, 0x10 }, { 0x17, 0x08 }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, { 0x52, 0x03 }, { 0x53, 0x07 }, { 0x54, 0x00 }, { 0x55, 0x00 }, @@ -1514,7 +1533,7 @@ void genesys_init_sensor_tables() { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, } }, - { { 2400 }, 2400, 5280, { 1504, 1030, 766 }, Ratio{1, 4}, 1, 5136, {0, 2, 1, 3}, { + { { 2400 }, 2400, 5280, { 1504, 1030, 766 }, Ratio{1, 4}, 1, 1280, 5136, {0, 2, 1, 3}, { { 0x16, 0x10 }, { 0x17, 0x06 }, { 0x18, 0x00 }, { 0x19, 0xff }, { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, { 0x52, 0x03 }, { 0x53, 0x07 }, { 0x54, 0x00 }, { 0x55, 0x00 }, @@ -1535,6 +1554,7 @@ void genesys_init_sensor_tables() sensor.exposure = setting.exposure; sensor.pixel_count_ratio = setting.pixel_count_ratio; sensor.shading_factor = setting.shading_factor; + sensor.output_pixel_offset = setting.output_pixel_offset; sensor.segment_size = setting.segment_size; sensor.segment_order = setting.segment_order; sensor.custom_regs = setting.custom_regs; @@ -2358,17 +2378,18 @@ void genesys_init_sensor_tables() ValueFilterAny resolutions; unsigned register_dpihw; unsigned shading_factor; + unsigned output_pixel_offset; }; CustomSensorSettings custom_settings[] = { - { { 75 }, 600, 8 }, - { { 100 }, 600, 6 }, - { { 150 }, 600, 4 }, - { { 200 }, 600, 3 }, - { { 300 }, 600, 2 }, - { { 600 }, 600, 1 }, - { { 1200 }, 1200, 1, }, - { { 2400 }, 2400, 1, }, + { { 75 }, 600, 8, 4 }, + { { 100 }, 600, 6, 5 }, + { { 150 }, 600, 4, 8 }, + { { 200 }, 600, 3, 10 }, + { { 300 }, 600, 2, 16 }, + { { 600 }, 600, 1, 32 }, + { { 1200 }, 1200, 1, 64 }, + { { 2400 }, 2400, 1, 128 }, }; auto base_custom_regs = sensor.custom_regs; @@ -2378,6 +2399,7 @@ void genesys_init_sensor_tables() sensor.register_dpihw = setting.register_dpihw; sensor.shading_resolution = setting.register_dpihw; sensor.shading_factor = setting.shading_factor; + sensor.output_pixel_offset = setting.output_pixel_offset; s_sensors->push_back(sensor); } } From 87f5637a47f52499a2d87b12b5903db8b401c20d Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Mon, 13 Apr 2020 07:23:42 +0300 Subject: [PATCH 6/7] genesys: Cleanup pixel position handling on gl124 --- backend/genesys/low.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/backend/genesys/low.cpp b/backend/genesys/low.cpp index 3e380729a..a68a7ee47 100644 --- a/backend/genesys/low.cpp +++ b/backend/genesys/low.cpp @@ -838,18 +838,11 @@ void compute_session_pixel_offsets(const Genesys_Device* dev, ScanSession& s, } else if (dev->model->asic_type == AsicType::GL843 || dev->model->asic_type == AsicType::GL845 || dev->model->asic_type == AsicType::GL846 || - dev->model->asic_type == AsicType::GL847) + dev->model->asic_type == AsicType::GL847 || + dev->model->asic_type == AsicType::GL124) { s.pixel_startx = s.output_startx * sensor.optical_res / s.params.xres; s.pixel_endx = s.pixel_startx + s.optical_pixels_raw; - - } else if (dev->model->asic_type == AsicType::GL124) { - unsigned startx = s.params.startx * sensor.optical_res / s.params.xres; - - s.pixel_startx = startx; - - // FIXME: should we add sensor.dummy_pxel to pixel_startx at this point? - s.pixel_endx = s.pixel_startx + s.optical_pixels; } s.pixel_startx = sensor.pixel_count_ratio.apply(s.pixel_startx); From 922cabc0befe832a965e67c866d3862f172978ba Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Mon, 13 Apr 2020 07:23:43 +0300 Subject: [PATCH 7/7] genesys: Remove no longer used ccd_start_xoffset --- backend/genesys/sensor.cpp | 1 - backend/genesys/sensor.h | 4 -- backend/genesys/tables_sensor.cpp | 40 ------------------- .../backend/genesys/tests_calibration.cpp | 1 - 4 files changed, 46 deletions(-) diff --git a/backend/genesys/sensor.cpp b/backend/genesys/sensor.cpp index e751e4f56..73c968316 100644 --- a/backend/genesys/sensor.cpp +++ b/backend/genesys/sensor.cpp @@ -133,7 +133,6 @@ std::ostream& operator<<(std::ostream& out, const Genesys_Sensor& sensor) << " output_pixel_offset: " << sensor.output_pixel_offset << '\n' << " black_pixels: " << sensor.black_pixels << '\n' << " dummy_pixel: " << sensor.dummy_pixel << '\n' - << " ccd_start_xoffset: " << sensor.ccd_start_xoffset << '\n' << " fau_gain_white_ref: " << sensor.fau_gain_white_ref << '\n' << " gain_white_ref: " << sensor.gain_white_ref << '\n' << " exposure: " << format_indent_braced_list(4, sensor.exposure) << '\n' diff --git a/backend/genesys/sensor.h b/backend/genesys/sensor.h index 977a72454..e3dc11ace 100644 --- a/backend/genesys/sensor.h +++ b/backend/genesys/sensor.h @@ -296,8 +296,6 @@ struct Genesys_Sensor { int black_pixels = 0; // value of the dummy register int dummy_pixel = 0; - // last pixel of CCD margin at optical resolution - int ccd_start_xoffset = 0; // TA CCD target code (reference gain) int fau_gain_white_ref = 0; // CCD target code (reference gain) @@ -371,7 +369,6 @@ struct Genesys_Sensor { output_pixel_offset == other.output_pixel_offset && black_pixels == other.black_pixels && dummy_pixel == other.dummy_pixel && - ccd_start_xoffset == other.ccd_start_xoffset && fau_gain_white_ref == other.fau_gain_white_ref && gain_white_ref == other.gain_white_ref && exposure == other.exposure && @@ -401,7 +398,6 @@ void serialize(Stream& str, Genesys_Sensor& x) serialize(str, x.pixel_count_ratio); serialize(str, x.black_pixels); serialize(str, x.dummy_pixel); - serialize(str, x.ccd_start_xoffset); serialize(str, x.fau_gain_white_ref); serialize(str, x.gain_white_ref); serialize_newline(str); diff --git a/backend/genesys/tables_sensor.cpp b/backend/genesys/tables_sensor.cpp index 3f67b3f96..6cdd41b69 100644 --- a/backend/genesys/tables_sensor.cpp +++ b/backend/genesys/tables_sensor.cpp @@ -100,7 +100,6 @@ void genesys_init_sensor_tables() sensor.optical_res = 1200; sensor.black_pixels = 48; sensor.dummy_pixel = 64; - sensor.ccd_start_xoffset = 0; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 230; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; @@ -144,7 +143,6 @@ void genesys_init_sensor_tables() sensor.optical_res = 600; sensor.black_pixels = 48; sensor.dummy_pixel = 85; - sensor.ccd_start_xoffset = 152; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 230; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; @@ -186,7 +184,6 @@ void genesys_init_sensor_tables() sensor.optical_res = 1200; sensor.black_pixels = 48; sensor.dummy_pixel = 64; - sensor.ccd_start_xoffset = 0; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 230; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; @@ -231,7 +228,6 @@ void genesys_init_sensor_tables() sensor.ccd_size_divisor = 2; sensor.black_pixels = 48; sensor.dummy_pixel = 16; - sensor.ccd_start_xoffset = 0; sensor.fau_gain_white_ref = 190; sensor.gain_white_ref = 190; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; @@ -361,7 +357,6 @@ void genesys_init_sensor_tables() sensor.optical_res = 1200; sensor.black_pixels = 48; sensor.dummy_pixel = 15; - sensor.ccd_start_xoffset = 0; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 200; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; @@ -463,7 +458,6 @@ void genesys_init_sensor_tables() sensor.ccd_size_divisor = 2; sensor.black_pixels = 48; sensor.dummy_pixel = 20; - sensor.ccd_start_xoffset = 0; sensor.fau_gain_white_ref = 180; sensor.gain_white_ref = 180; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; @@ -548,7 +542,6 @@ void genesys_init_sensor_tables() sensor.ccd_size_divisor = 2; sensor.black_pixels = 87; sensor.dummy_pixel = 87; - sensor.ccd_start_xoffset = 0; sensor.fau_gain_white_ref = 0; sensor.gain_white_ref = 0; sensor.exposure = { 0x0400, 0x0400, 0x0400 }; @@ -609,7 +602,6 @@ void genesys_init_sensor_tables() sensor.optical_res = 600; sensor.black_pixels = 5; sensor.dummy_pixel = 38; - sensor.ccd_start_xoffset = 0; sensor.fau_gain_white_ref = 200; sensor.gain_white_ref = 200; sensor.exposure = { 0x1450, 0x0c80, 0x0a28 }; @@ -672,7 +664,6 @@ void genesys_init_sensor_tables() sensor.optical_res = 1200; sensor.black_pixels = 48; sensor.dummy_pixel = 16; - sensor.ccd_start_xoffset = 0; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 200; sensor.exposure = { 0, 0, 0 }; @@ -784,7 +775,6 @@ void genesys_init_sensor_tables() sensor.shading_resolution = 600; sensor.black_pixels = 27; sensor.dummy_pixel = 27; - sensor.ccd_start_xoffset = 0; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 200; sensor.exposure = { 0x1100, 0x1100, 0x1100 }; @@ -841,7 +831,6 @@ void genesys_init_sensor_tables() sensor.shading_resolution = 600; sensor.black_pixels = 27; sensor.dummy_pixel = 27; - sensor.ccd_start_xoffset = 0; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 200; sensor.exposure = { 0x1100, 0x1100, 0x1100 }; @@ -899,7 +888,6 @@ void genesys_init_sensor_tables() sensor.shading_resolution = 600; sensor.black_pixels = 28; sensor.dummy_pixel = 28; - sensor.ccd_start_xoffset = 0; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 200; sensor.exposure = { 0x1544, 0x1544, 0x1544 }; @@ -956,7 +944,6 @@ void genesys_init_sensor_tables() sensor.shading_resolution = 600; sensor.black_pixels = 27; sensor.dummy_pixel = 27; - sensor.ccd_start_xoffset = 0; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 200; sensor.exposure = { 0x1100, 0x1100, 0x1100 }; @@ -1013,7 +1000,6 @@ void genesys_init_sensor_tables() sensor.shading_resolution = 600; sensor.black_pixels = 27; sensor.dummy_pixel = 27; - sensor.ccd_start_xoffset = 0; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 200; sensor.exposure = { 0x1100, 0x1100, 0x1100 }; @@ -1071,7 +1057,6 @@ void genesys_init_sensor_tables() sensor.optical_res = 600; sensor.black_pixels = 27; sensor.dummy_pixel = 27; - sensor.ccd_start_xoffset = 0; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 200; sensor.exposure = { 0x1100, 0x1100, 0x1100 }; @@ -1126,7 +1111,6 @@ void genesys_init_sensor_tables() sensor.optical_res = 4800; sensor.black_pixels = 87*4; sensor.dummy_pixel = 16*4; - sensor.ccd_start_xoffset = 320*8; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 200; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; @@ -1289,8 +1273,6 @@ void genesys_init_sensor_tables() sensor.optical_res = 4800; sensor.black_pixels = 73*8; // black pixels 73 at 600 dpi sensor.dummy_pixel = 16*8; - // 384 at 600 dpi - sensor.ccd_start_xoffset = 384*8; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 200; sensor.gamma = { 1.0f, 1.0f, 1.0f }; @@ -1435,7 +1417,6 @@ void genesys_init_sensor_tables() sensor.optical_res = 2400; sensor.black_pixels = 87*4; sensor.dummy_pixel = 16*4; - sensor.ccd_start_xoffset = 320*4; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 200; sensor.exposure = { 0x01c1, 0x0126, 0x00e5 }; @@ -1569,7 +1550,6 @@ void genesys_init_sensor_tables() sensor.shading_resolution = 600; sensor.black_pixels = 38; sensor.dummy_pixel = 38; - sensor.ccd_start_xoffset = 152; sensor.fau_gain_white_ref = 160; sensor.gain_white_ref = 160; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; @@ -1636,7 +1616,6 @@ void genesys_init_sensor_tables() sensor.black_pixels = 50*8; // 31 at 600 dpi dummy_pixels 58 at 1200 sensor.dummy_pixel = 58; - sensor.ccd_start_xoffset = 152; sensor.fau_gain_white_ref = 160; sensor.gain_white_ref = 160; sensor.exposure = { 0x2c09, 0x22b8, 0x10f0 }; @@ -1764,7 +1743,6 @@ void genesys_init_sensor_tables() sensor.optical_res = 4800; sensor.black_pixels = 100; sensor.dummy_pixel = 58; - sensor.ccd_start_xoffset = 152; sensor.fau_gain_white_ref = 160; sensor.gain_white_ref = 160; sensor.exposure = { 0x2c09, 0x22b8, 0x10f0 }; @@ -1889,7 +1867,6 @@ void genesys_init_sensor_tables() sensor.black_pixels = 50*8; // 31 at 600 dpi, 58 at 1200 dpi sensor.dummy_pixel = 20; - sensor.ccd_start_xoffset = 152; sensor.fau_gain_white_ref = 160; sensor.gain_white_ref = 160; sensor.exposure = { 0x9c40, 0x9c40, 0x9c40 }; @@ -2014,7 +1991,6 @@ void genesys_init_sensor_tables() sensor.black_pixels = 50*8; // 31 at 600 dpi, 58 at 1200 dpi sensor.dummy_pixel = 20; - sensor.ccd_start_xoffset = 152; sensor.fau_gain_white_ref = 160; sensor.gain_white_ref = 160; sensor.exposure = { 0x9c40, 0x9c40, 0x9c40 }; @@ -2173,7 +2149,6 @@ void genesys_init_sensor_tables() sensor.ccd_size_divisor = 4; sensor.black_pixels = 31; sensor.dummy_pixel = 20; - sensor.ccd_start_xoffset = 0; // not used at the moment sensor.fau_gain_white_ref = 160; sensor.gain_white_ref = 160; sensor.exposure = { 0x9c40, 0x9c40, 0x9c40 }; @@ -2347,7 +2322,6 @@ void genesys_init_sensor_tables() sensor.black_pixels = 96; sensor.dummy_pixel = 26; sensor.pixel_count_ratio = Ratio{1, 4}; - sensor.ccd_start_xoffset = 128; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 230; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; @@ -2410,7 +2384,6 @@ void genesys_init_sensor_tables() sensor.ccd_size_divisor = 2; sensor.black_pixels = 87; sensor.dummy_pixel = 16; - sensor.ccd_start_xoffset = 303; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 200; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; @@ -2580,7 +2553,6 @@ void genesys_init_sensor_tables() sensor.ccd_size_divisor = 2; sensor.black_pixels = 87; sensor.dummy_pixel = 16; - sensor.ccd_start_xoffset = 303; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 200; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; @@ -2751,7 +2723,6 @@ void genesys_init_sensor_tables() sensor.ccd_size_divisor = 2; sensor.black_pixels = 87; sensor.dummy_pixel = 16; - sensor.ccd_start_xoffset = 303; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 200; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; @@ -2947,7 +2918,6 @@ void genesys_init_sensor_tables() sensor.ccd_size_divisor = 2; sensor.black_pixels = 87; sensor.dummy_pixel = 16; - sensor.ccd_start_xoffset = 303; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 200; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; @@ -3143,7 +3113,6 @@ void genesys_init_sensor_tables() sensor.ccd_size_divisor = 2; sensor.black_pixels = 87; sensor.dummy_pixel = 87; - sensor.ccd_start_xoffset = 0; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 230; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; @@ -3204,7 +3173,6 @@ void genesys_init_sensor_tables() sensor.register_dpihw = 1200; sensor.black_pixels = 88; // TODO sensor.dummy_pixel = 20; - sensor.ccd_start_xoffset = 0; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 230; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; @@ -3293,7 +3261,6 @@ void genesys_init_sensor_tables() sensor.register_dpihw = 1200; sensor.black_pixels = 88; // TODO sensor.dummy_pixel = 20; - sensor.ccd_start_xoffset = 0; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 230; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; @@ -3368,7 +3335,6 @@ void genesys_init_sensor_tables() sensor.register_dpihw = 1200; sensor.black_pixels = 88; // TODO sensor.dummy_pixel = 20; - sensor.ccd_start_xoffset = 120; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 230; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; @@ -3420,7 +3386,6 @@ void genesys_init_sensor_tables() sensor.register_dpihw = 1200; sensor.black_pixels = 88; // TODO sensor.dummy_pixel = 20; - sensor.ccd_start_xoffset = 0; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 230; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; @@ -3502,7 +3467,6 @@ void genesys_init_sensor_tables() sensor.register_dpihw = 1200; sensor.black_pixels = 88; // TODO sensor.dummy_pixel = 20; - sensor.ccd_start_xoffset = 120; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 230; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; @@ -3563,7 +3527,6 @@ void genesys_init_sensor_tables() sensor.optical_res = 1200; sensor.black_pixels = 31; sensor.dummy_pixel = 31; - sensor.ccd_start_xoffset = 0; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 200; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; @@ -3619,7 +3582,6 @@ void genesys_init_sensor_tables() sensor.optical_res = 1200; sensor.black_pixels = 31; sensor.dummy_pixel = 31; - sensor.ccd_start_xoffset = 0; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 200; sensor.exposure = { 0, 0, 0 }; @@ -3672,8 +3634,6 @@ void genesys_init_sensor_tables() sensor.ccd_size_divisor = 2; sensor.black_pixels = 20; sensor.dummy_pixel = 6; - // tuned to give 3*8 multiple startx coordinate during shading calibration - sensor.ccd_start_xoffset = 34; // 14=>3, 20=>2 sensor.fau_gain_white_ref = 150; sensor.gain_white_ref = 150; // maps to 0x70-0x73 for GL841 diff --git a/testsuite/backend/genesys/tests_calibration.cpp b/testsuite/backend/genesys/tests_calibration.cpp index b953c29a7..a7cf607c9 100644 --- a/testsuite/backend/genesys/tests_calibration.cpp +++ b/testsuite/backend/genesys/tests_calibration.cpp @@ -69,7 +69,6 @@ Genesys_Calibration_Cache create_fake_calibration_entry() sensor.optical_res = 1200; sensor.black_pixels = 48; sensor.dummy_pixel = 64; - sensor.ccd_start_xoffset = 0; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 230; sensor.exposure = { 0x0000, 0x0000, 0x0000 };