diff --git a/backend/genesys/genesys.cpp b/backend/genesys/genesys.cpp index 451bfc7f5..d89640733 100644 --- a/backend/genesys/genesys.cpp +++ b/backend/genesys/genesys.cpp @@ -1341,17 +1341,6 @@ bool should_calibrate_only_active_area(const Genesys_Device& dev, return false; } -float get_model_x_offset_ta(const Genesys_Device& dev, const Genesys_Settings& settings) -{ - if (dev.model->model_id == ModelId::CANON_8600F && settings.xres == 4800) { - return 85.0f; - } - if (dev.model->model_id == ModelId::CANON_4400F && settings.xres == 4800) { - return dev.model->x_offset_ta - 10.0; - } - return dev.model->x_offset_ta; -} - void scanner_offset_calibration(Genesys_Device& dev, const Genesys_Sensor& sensor, Genesys_Register_Set& regs) { @@ -1414,7 +1403,7 @@ void scanner_offset_calibration(Genesys_Device& dev, const Genesys_Sensor& senso black_pixels = calib_sensor->black_pixels / factor; if (should_calibrate_only_active_area(dev, dev.settings)) { - float offset = get_model_x_offset_ta(dev, dev.settings); + float offset = dev.model->x_offset_ta; offset /= calib_sensor->get_ccd_size_divisor_for_dpi(resolution); start_pixel = static_cast((offset * resolution) / MM_PER_INCH); diff --git a/backend/genesys/gl124.cpp b/backend/genesys/gl124.cpp index 0d8ce9cb8..865a38665 100644 --- a/backend/genesys/gl124.cpp +++ b/backend/genesys/gl124.cpp @@ -801,7 +801,7 @@ static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens dev->line_count = 0; - build_image_pipeline(dev, sensor, session); + build_image_pipeline(dev, session); // MAXWD is expressed in 2 words unit diff --git a/backend/genesys/gl646.cpp b/backend/genesys/gl646.cpp index 1d46c258f..ef560cd34 100644 --- a/backend/genesys/gl646.cpp +++ b/backend/genesys/gl646.cpp @@ -515,7 +515,7 @@ void CommandSetGl646::init_regs_for_scan_session(Genesys_Device* dev, const Gene dev->read_buffer.clear(); dev->read_buffer.alloc(session.buffer_size_read); - build_image_pipeline(dev, sensor, session); + build_image_pipeline(dev, session); dev->read_active = true; diff --git a/backend/genesys/gl841.cpp b/backend/genesys/gl841.cpp index 6124242e0..7e0ee625c 100644 --- a/backend/genesys/gl841.cpp +++ b/backend/genesys/gl841.cpp @@ -1369,7 +1369,7 @@ dummy \ scanned lines dev->read_buffer.clear(); dev->read_buffer.alloc(session.buffer_size_read); - build_image_pipeline(dev, sensor, session); + build_image_pipeline(dev, session); dev->read_active = true; diff --git a/backend/genesys/gl843.cpp b/backend/genesys/gl843.cpp index 2ae985449..a80017998 100644 --- a/backend/genesys/gl843.cpp +++ b/backend/genesys/gl843.cpp @@ -1136,7 +1136,7 @@ void CommandSetGl843::init_regs_for_scan_session(Genesys_Device* dev, const Gene dev->read_buffer.clear(); dev->read_buffer.alloc(session.buffer_size_read); - build_image_pipeline(dev, sensor, session); + build_image_pipeline(dev, session); dev->read_active = true; @@ -1182,21 +1182,12 @@ ScanSession CommandSetGl843::calculate_scan_session(const Genesys_Device* dev, if (settings.scan_method==ScanMethod::TRANSPARENCY || settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) { - start = get_model_x_offset_ta(*dev, settings); + start = dev->model->x_offset_ta; } else { start = dev->model->x_offset; } start = start + settings.tl_x; - if ((dev->model->model_id == ModelId::CANON_4400F && - settings.scan_method == ScanMethod::TRANSPARENCY) || - dev->model->model_id == ModelId::CANON_8400F || - dev->model->model_id == ModelId::CANON_8600F) - { - // FIXME: this is probably just an artifact of a bug elsewhere - start /= sensor.get_ccd_size_divisor_for_dpi(settings.xres); - } - start = static_cast((start * settings.xres) / MM_PER_INCH); ScanSession session; @@ -1474,7 +1465,7 @@ void CommandSetGl843::init_regs_for_shading(Genesys_Device* dev, const Genesys_S unsigned calib_pixels_offset = 0; if (should_calibrate_only_active_area(*dev, dev->settings)) { - float offset = get_model_x_offset_ta(*dev, dev->settings); + float offset = dev->model->x_offset_ta; // FIXME: we should use resolution here offset = static_cast((offset * dev->settings.xres) / MM_PER_INCH); @@ -1498,6 +1489,12 @@ void CommandSetGl843::init_regs_for_shading(Genesys_Device* dev, const Genesys_S // note: move_to_ta() function has already been called and the sensor is at the // transparency adapter move = static_cast(dev->model->y_offset_calib_white_ta - dev->model->y_offset_sensor_to_ta); + if (dev->model->model_id == ModelId::CANON_8600F && resolution == 2400) { + move /= 2; + } + if (dev->model->model_id == ModelId::CANON_8600F && resolution == 4800) { + move /= 4; + } flags |= ScanFlag::USE_XPA; } else { move = static_cast(dev->model->y_offset_calib_white); @@ -1973,7 +1970,7 @@ void CommandSetGl843::send_shading_data(Genesys_Device* dev, const Genesys_Senso uint8_t *buffer; int count; - unsigned offset = 0; + int offset = 0; unsigned length = size; if (dev->reg.get8(REG_0x01) & REG_0x01_SHDAREA) { @@ -1983,9 +1980,13 @@ void CommandSetGl843::send_shading_data(Genesys_Device* dev, const Genesys_Senso length = dev->session.output_pixels * sensor.shading_resolution / dev->session.params.xres; + offset += sensor.shading_pixel_offset; + // 16 bit words, 2 words per color, 3 color channels length *= 2 * 2 * 3; offset *= 2 * 2 * 3; + } else { + offset += sensor.shading_pixel_offset * 2 * 2 * 3; } dev->interface->record_key_value("shading_offset", std::to_string(offset)); @@ -1999,6 +2000,11 @@ void CommandSetGl843::send_shading_data(Genesys_Device* dev, const Genesys_Senso /* copy regular shading data to the expected layout */ buffer = final_data.data(); count = 0; + if (offset < 0) { + count += (-offset); + length -= (-offset); + offset = 0; + } /* loop over calibration data */ for (i = 0; i < length; i++) diff --git a/backend/genesys/gl846.cpp b/backend/genesys/gl846.cpp index b935e476a..e5c3f4133 100644 --- a/backend/genesys/gl846.cpp +++ b/backend/genesys/gl846.cpp @@ -709,7 +709,7 @@ static void gl846_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens reg->set16(REG_STRPIXEL, session.pixel_startx); reg->set16(REG_ENDPIXEL, session.pixel_endx); - build_image_pipeline(dev, sensor, session); + build_image_pipeline(dev, session); /* MAXWD is expressed in 4 words unit */ // BUG: we shouldn't multiply by channels here diff --git a/backend/genesys/gl847.cpp b/backend/genesys/gl847.cpp index 7ca7c4b28..7933b2552 100644 --- a/backend/genesys/gl847.cpp +++ b/backend/genesys/gl847.cpp @@ -610,7 +610,7 @@ static void gl847_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens reg->set16(REG_STRPIXEL, session.pixel_startx); reg->set16(REG_ENDPIXEL, session.pixel_endx); - build_image_pipeline(dev, sensor, session); + build_image_pipeline(dev, session); /* MAXWD is expressed in 4 words unit */ // BUG: we shouldn't multiply by channels here diff --git a/backend/genesys/low.cpp b/backend/genesys/low.cpp index a68a7ee47..2625c4a15 100644 --- a/backend/genesys/low.cpp +++ b/backend/genesys/low.cpp @@ -831,12 +831,12 @@ void compute_session_pixel_offsets(const Genesys_Device* dev, ScanSession& s, 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) { + } else if (dev->model->asic_type == AsicType::GL841 || + dev->model->asic_type == AsicType::GL843) { 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 || - dev->model->asic_type == AsicType::GL845 || + } else if (dev->model->asic_type == AsicType::GL845 || dev->model->asic_type == AsicType::GL846 || dev->model->asic_type == AsicType::GL847 || dev->model->asic_type == AsicType::GL124) @@ -955,7 +955,11 @@ void compute_session(const Genesys_Device* dev, ScanSession& s, const Genesys_Se // after all adjustments on the optical pixels have been made, compute the number of pixels // to retrieve from the chip s.output_pixels = (s.optical_pixels * s.output_resolution) / s.optical_resolution; - s.output_startx = s.params.startx + sensor.output_pixel_offset; + + if (static_cast(s.params.startx) + sensor.output_pixel_offset < 0) + throw SaneException("Invalid sensor.output_pixel_offset"); + s.output_startx = static_cast( + static_cast(s.params.startx) + sensor.output_pixel_offset); s.num_staggered_lines = 0; if (!has_flag(s.params.flags, ScanFlag::IGNORE_STAGGER_OFFSET)) @@ -1111,8 +1115,7 @@ static std::size_t get_usb_buffer_read_size(AsicType asic, const ScanSession& se } } -void build_image_pipeline(Genesys_Device* dev, const Genesys_Sensor& sensor, - const ScanSession& session) +void build_image_pipeline(Genesys_Device* dev, const ScanSession& session) { static unsigned s_pipeline_index = 0; @@ -1221,14 +1224,9 @@ void build_image_pipeline(Genesys_Device* dev, const Genesys_Sensor& sensor, !has_flag(dev->model->flags, ModelFlag::NO_CALIBRATION) && !has_flag(session.params.flags, ScanFlag::DISABLE_SHADING)) { - unsigned pixel_shift = session.params.startx; - if (dev->model->model_id == ModelId::CANON_4400F) { - pixel_shift = - session.params.startx * sensor.optical_res / dev->calib_session.params.xres; - } dev->pipeline.push_node(dev->dark_average_data, dev->white_average_data, - pixel_shift * + session.params.startx * dev->calib_session.params.channels); if (DBG_LEVEL >= DBG_io2) { diff --git a/backend/genesys/low.h b/backend/genesys/low.h index 155da0d0a..0443bb9a9 100644 --- a/backend/genesys/low.h +++ b/backend/genesys/low.h @@ -329,8 +329,6 @@ void scanner_search_strip(Genesys_Device& dev, bool forward, bool black); bool should_calibrate_only_active_area(const Genesys_Device& dev, const Genesys_Settings& settings); -float get_model_x_offset_ta(const Genesys_Device& dev, const Genesys_Settings& settings); - void scanner_offset_calibration(Genesys_Device& dev, const Genesys_Sensor& sensor, Genesys_Register_Set& regs); @@ -436,8 +434,7 @@ extern void sanei_genesys_generate_gamma_buffer(Genesys_Device* dev, void compute_session(const Genesys_Device* dev, ScanSession& s, const Genesys_Sensor& sensor); -void build_image_pipeline(Genesys_Device* dev, const Genesys_Sensor& sensor, - const ScanSession& session); +void build_image_pipeline(Genesys_Device* dev, const ScanSession& session); std::uint8_t compute_frontend_gain(float value, float target_value, FrontendType frontend_type); diff --git a/backend/genesys/sensor.cpp b/backend/genesys/sensor.cpp index 73c968316..a74fb69e9 100644 --- a/backend/genesys/sensor.cpp +++ b/backend/genesys/sensor.cpp @@ -129,6 +129,7 @@ std::ostream& operator<<(std::ostream& out, const Genesys_Sensor& sensor) << " register_dpiset: " << sensor.register_dpiset << '\n' << " ccd_size_divisor: " << sensor.ccd_size_divisor << '\n' << " shading_factor: " << sensor.shading_factor << '\n' + << " shading_pixel_offset: " << sensor.shading_pixel_offset << '\n' << " pixel_count_ratio: " << sensor.pixel_count_ratio << '\n' << " output_pixel_offset: " << sensor.output_pixel_offset << '\n' << " black_pixels: " << sensor.black_pixels << '\n' diff --git a/backend/genesys/sensor.h b/backend/genesys/sensor.h index e3dc11ace..32f11adaf 100644 --- a/backend/genesys/sensor.h +++ b/backend/genesys/sensor.h @@ -286,12 +286,15 @@ struct Genesys_Sensor { // How many real pixels correspond to one shading pixel that is sent to the scanner unsigned shading_factor = 1; + // How many pixels the shading data is offset from the acquired data + int shading_pixel_offset = 0; + // This defines the ratio between logical pixel coordinates and the pixel coordinates sent to // the scanner. Ratio pixel_count_ratio = Ratio{1, 1}; // The offset in pixels in terms of scan resolution that needs to be applied to scan position. - unsigned output_pixel_offset = 0; + int output_pixel_offset = 0; int black_pixels = 0; // value of the dummy register @@ -365,6 +368,7 @@ struct Genesys_Sensor { shading_resolution == other.shading_resolution && ccd_size_divisor == other.ccd_size_divisor && shading_factor == other.shading_factor && + shading_pixel_offset == other.shading_pixel_offset && pixel_count_ratio == other.pixel_count_ratio && output_pixel_offset == other.output_pixel_offset && black_pixels == other.black_pixels && @@ -394,6 +398,7 @@ void serialize(Stream& str, Genesys_Sensor& x) serialize(str, x.shading_resolution); serialize(str, x.ccd_size_divisor); serialize(str, x.shading_factor); + serialize(str, x.shading_pixel_offset); serialize(str, x.output_pixel_offset); serialize(str, x.pixel_count_ratio); serialize(str, x.black_pixels); diff --git a/backend/genesys/tables_model.cpp b/backend/genesys/tables_model.cpp index 838ab8c73..6af192a9b 100644 --- a/backend/genesys/tables_model.cpp +++ b/backend/genesys/tables_model.cpp @@ -430,7 +430,7 @@ void genesys_init_usb_device_tables() model.bpp_color_values = { 8, 16 }; model.x_offset = 6.0; - model.y_offset = 12.00; + model.y_offset = 10.00; model.x_size = 215.9; model.y_size = 297.0; diff --git a/backend/genesys/tables_sensor.cpp b/backend/genesys/tables_sensor.cpp index 6cdd41b69..8ae87a54f 100644 --- a/backend/genesys/tables_sensor.cpp +++ b/backend/genesys/tables_sensor.cpp @@ -118,7 +118,7 @@ void genesys_init_sensor_tables() { ValueFilterAny resolutions; unsigned register_dpiset; - unsigned output_pixel_offset; + int output_pixel_offset; }; CustomSensorSettings custom_settings[] = { @@ -160,7 +160,7 @@ void genesys_init_sensor_tables() struct CustomSensorSettings { ValueFilterAny resolutions; - unsigned output_pixel_offset; + int output_pixel_offset; }; CustomSensorSettings custom_settings[] = { @@ -202,7 +202,7 @@ void genesys_init_sensor_tables() { ValueFilterAny resolutions; unsigned register_dpiset; - unsigned output_pixel_offset; + int output_pixel_offset; }; CustomSensorSettings custom_settings[] = { @@ -250,7 +250,7 @@ void genesys_init_sensor_tables() unsigned exposure_lperiod; unsigned ccd_size_divisor; Ratio pixel_count_ratio; - unsigned output_pixel_offset; + int output_pixel_offset; GenesysRegisterSettingSet custom_regs; }; @@ -378,7 +378,7 @@ void genesys_init_sensor_tables() unsigned register_dpiset; unsigned exposure_lperiod; Ratio pixel_count_ratio; - unsigned output_pixel_offset; + int output_pixel_offset; GenesysRegisterSettingSet custom_regs; }; @@ -479,7 +479,7 @@ void genesys_init_sensor_tables() unsigned exposure_lperiod; unsigned ccd_size_divisor; Ratio pixel_count_ratio; - unsigned output_pixel_offset; + int output_pixel_offset; GenesysRegisterSettingSet custom_regs; }; @@ -574,7 +574,7 @@ void genesys_init_sensor_tables() unsigned register_dpihw; unsigned register_dpiset; unsigned shading_resolution; - unsigned output_pixel_offset; + int output_pixel_offset; }; CustomSensorSettings custom_settings[] = { @@ -630,7 +630,7 @@ void genesys_init_sensor_tables() std::vector channels; unsigned exposure_lperiod; SensorExposure exposure; - unsigned output_pixel_offset; + int output_pixel_offset; }; CustomSensorSettings custom_settings[] = { @@ -685,7 +685,7 @@ void genesys_init_sensor_tables() unsigned register_dpiset; unsigned exposure_lperiod; Ratio pixel_count_ratio; - unsigned output_pixel_offset; + int output_pixel_offset; GenesysRegisterSettingSet custom_regs; }; @@ -805,7 +805,7 @@ void genesys_init_sensor_tables() { ValueFilterAny resolutions; unsigned register_dpiset; - unsigned output_pixel_offset; + int output_pixel_offset; }; CustomSensorSettings custom_settings[] = { @@ -861,7 +861,7 @@ void genesys_init_sensor_tables() { ValueFilterAny resolutions; unsigned register_dpiset; - unsigned output_pixel_offset; + int output_pixel_offset; }; CustomSensorSettings custom_settings[] = { @@ -918,7 +918,7 @@ void genesys_init_sensor_tables() { ValueFilterAny resolutions; unsigned register_dpiset; - unsigned output_pixel_offset; + int output_pixel_offset; }; CustomSensorSettings custom_settings[] = { @@ -974,7 +974,7 @@ void genesys_init_sensor_tables() { ValueFilterAny resolutions; unsigned register_dpiset; - unsigned output_pixel_offset; + int output_pixel_offset; }; CustomSensorSettings custom_settings[] = { @@ -1030,7 +1030,7 @@ void genesys_init_sensor_tables() { ValueFilterAny resolutions; unsigned register_dpiset; - unsigned output_pixel_offset; + int output_pixel_offset; }; CustomSensorSettings custom_settings[] = { @@ -1087,7 +1087,7 @@ void genesys_init_sensor_tables() { ValueFilterAny resolutions; unsigned register_dpiset; - unsigned output_pixel_offset; + int output_pixel_offset; }; CustomSensorSettings custom_settings[] = { @@ -1125,7 +1125,7 @@ void genesys_init_sensor_tables() SensorExposure exposure; Ratio pixel_count_ratio; unsigned shading_factor; - unsigned output_pixel_offset; + int output_pixel_offset; unsigned segment_size; std::vector segment_order; GenesysRegisterSettingSet custom_regs; @@ -1286,7 +1286,7 @@ void genesys_init_sensor_tables() SensorExposure exposure; Ratio pixel_count_ratio; unsigned shading_factor; - unsigned output_pixel_offset; + int output_pixel_offset; unsigned segment_size; std::vector segment_order; GenesysRegisterSettingSet custom_regs; @@ -1431,7 +1431,7 @@ void genesys_init_sensor_tables() SensorExposure exposure; Ratio pixel_count_ratio; unsigned shading_factor; - unsigned output_pixel_offset; + int output_pixel_offset; unsigned segment_size; std::vector segment_order; GenesysRegisterSettingSet custom_regs; @@ -1589,7 +1589,7 @@ void genesys_init_sensor_tables() ValueFilterAny resolutions; unsigned register_dpiset; Ratio pixel_count_ratio; - unsigned output_pixel_offset; + int output_pixel_offset; }; CustomSensorSettings custom_settings[] = { @@ -1632,7 +1632,7 @@ void genesys_init_sensor_tables() int exposure_lperiod; ScanMethod method; Ratio pixel_count_ratio; - unsigned output_pixel_offset; + int output_pixel_offset; GenesysRegisterSettingSet extra_custom_regs; }; @@ -1759,7 +1759,7 @@ void genesys_init_sensor_tables() int exposure_lperiod; ScanMethod method; Ratio pixel_count_ratio; - unsigned output_pixel_offset; + int output_pixel_offset; GenesysRegisterSettingSet extra_custom_regs; }; @@ -1880,14 +1880,14 @@ void genesys_init_sensor_tables() unsigned register_dpiset; int exposure_lperiod; bool use_host_side_calib; - unsigned output_pixel_offset; + int output_pixel_offset; std::vector methods; GenesysRegisterSettingSet extra_custom_regs; GenesysRegisterSettingSet extra_custom_fe_regs; }; CustomSensorSettings custom_settings[] = { - { { 300 }, 1200, 11640, false, 1, { ScanMethod::FLATBED }, { + { { 300 }, 1200, 11640, false, 197, { 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 }, @@ -1899,7 +1899,7 @@ void genesys_init_sensor_tables() { 0x9e, 0x2d }, }, {} }, - { { 600 }, 2400, 11640, false, 2, { ScanMethod::FLATBED }, { + { { 600 }, 2400, 11640, false, 392, { 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 }, @@ -1911,7 +1911,7 @@ void genesys_init_sensor_tables() { 0x9e, 0x2d }, }, {} }, - { { 1200 }, 4800, 11640, false, 5, { ScanMethod::FLATBED }, { + { { 1200 }, 4800, 11640, false, 794, { 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 }, @@ -1949,7 +1949,7 @@ void genesys_init_sensor_tables() { 0x03, 0x1f }, } }, - { { 4800 }, 4800, 33300, true, 20, { ScanMethod::TRANSPARENCY }, { + { { 4800 }, 4800, 33300, true, -2063, { 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 }, @@ -2005,14 +2005,15 @@ void genesys_init_sensor_tables() unsigned register_dpiset; Ratio pixel_count_ratio; int exposure_lperiod; - unsigned output_pixel_offset; + int output_pixel_offset; + int shading_pixel_offset; std::vector methods; GenesysRegisterSettingSet extra_custom_regs; GenesysRegisterSettingSet custom_fe_regs; }; CustomSensorSettings custom_settings[] = { - { { 400 }, 2400, Ratio{1, 4}, 7200, 2, { ScanMethod::FLATBED }, { + { { 400 }, 2400, Ratio{1, 4}, 7200, 2, 0, { 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 }, @@ -2024,7 +2025,7 @@ void genesys_init_sensor_tables() { 0x80, 0x2a }, }, {} }, - { { 800 }, 4800, Ratio{1, 4}, 7200, 5, { ScanMethod::FLATBED }, { + { { 800 }, 4800, Ratio{1, 4}, 7200, 5, 13, { 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 }, @@ -2036,7 +2037,7 @@ void genesys_init_sensor_tables() { 0x80, 0x20 }, }, {} }, - { { 1600 }, 4800, Ratio{1, 2}, 14400, 10, { ScanMethod::FLATBED }, { + { { 1600 }, 4800, Ratio{1, 2}, 14400, 10, 8, { 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 }, @@ -2050,7 +2051,7 @@ void genesys_init_sensor_tables() { 0x03, 0x1f }, } }, - { { 3200 }, 4800, Ratio{1, 1}, 28800, 20, { ScanMethod::FLATBED }, { + { { 3200 }, 4800, Ratio{1, 1}, 28800, 20, -2, { 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 }, @@ -2064,8 +2065,8 @@ void genesys_init_sensor_tables() { 0x03, 0x1f }, }, }, - { { 400 }, 2400, Ratio{1, 4}, 14400, 2, { ScanMethod::TRANSPARENCY, - ScanMethod::TRANSPARENCY_INFRARED }, { + { { 400 }, 2400, Ratio{1, 4}, 14400, 2, 0, { 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 }, @@ -2077,8 +2078,8 @@ void genesys_init_sensor_tables() { 0x80, 0x20 }, }, {} }, - { { 800 }, 4800, Ratio{1, 4}, 14400, 5, { ScanMethod::TRANSPARENCY, - ScanMethod::TRANSPARENCY_INFRARED }, { + { { 800 }, 4800, Ratio{1, 4}, 14400, 5, 13, { 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 }, @@ -2090,8 +2091,8 @@ void genesys_init_sensor_tables() { 0x80, 0x20 }, }, {} }, - { { 1600 }, 4800, Ratio{1, 2}, 28800, 10, { ScanMethod::TRANSPARENCY, - ScanMethod::TRANSPARENCY_INFRARED }, { + { { 1600 }, 4800, Ratio{1, 2}, 28800, 10, 8, { 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 }, @@ -2105,8 +2106,8 @@ void genesys_init_sensor_tables() { 0x03, 0x1f }, }, }, - { { 3200 }, 4800, Ratio{1, 1}, 28800, 20, { ScanMethod::TRANSPARENCY, - ScanMethod::TRANSPARENCY_INFRARED }, { + { { 3200 }, 4800, Ratio{1, 1}, 28800, 20, 10, { 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 }, @@ -2127,11 +2128,12 @@ void genesys_init_sensor_tables() for (auto method : setting.methods) {for (auto resolution : setting.resolutions.values()) { sensor.resolutions = { resolution }; - sensor.shading_resolution = std::max(800u, resolution); + sensor.shading_resolution = resolution; 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.shading_pixel_offset = setting.shading_pixel_offset; sensor.method = method; sensor.custom_regs = setting.extra_custom_regs; sensor.custom_fe_regs = setting.custom_fe_regs; @@ -2162,7 +2164,7 @@ void genesys_init_sensor_tables() ValueFilterAny resolutions; unsigned register_dpiset; int exposure_lperiod; - unsigned output_pixel_offset; + int output_pixel_offset; std::vector methods; GenesysRegisterSettingSet extra_custom_regs; GenesysRegisterSettingSet custom_fe_regs; @@ -2214,7 +2216,7 @@ void genesys_init_sensor_tables() }, {}, }, - { { 300 }, 1200, 45000, 1, { ScanMethod::TRANSPARENCY, + { { 300 }, 1200, 45000, 6, { ScanMethod::TRANSPARENCY, ScanMethod::TRANSPARENCY_INFRARED }, { { 0x0c, 0x00 }, { 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, @@ -2230,7 +2232,7 @@ void genesys_init_sensor_tables() }, {}, }, - { { 600 }, 2400, 45000, 2, { ScanMethod::TRANSPARENCY, + { { 600 }, 2400, 45000, 11, { ScanMethod::TRANSPARENCY, ScanMethod::TRANSPARENCY_INFRARED }, { { 0x0c, 0x00 }, { 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, @@ -2246,7 +2248,7 @@ void genesys_init_sensor_tables() }, {}, }, - { { 1200 }, 4800, 45000, 5, { ScanMethod::TRANSPARENCY, + { { 1200 }, 4800, 45000, 23, { ScanMethod::TRANSPARENCY, ScanMethod::TRANSPARENCY_INFRARED }, { { 0x0c, 0x00 }, { 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, @@ -2278,8 +2280,8 @@ void genesys_init_sensor_tables() }, {}, }, - { { 4800 }, 4800, 45000, 20, { ScanMethod::TRANSPARENCY, - ScanMethod::TRANSPARENCY_INFRARED }, { + { { 4800 }, 4800, 45000, -1982, { ScanMethod::TRANSPARENCY, + ScanMethod::TRANSPARENCY_INFRARED }, { { 0x0c, 0x00 }, { 0x16, 0x13 }, { 0x17, 0x15 }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x61 }, { 0x1d, 0x75 }, @@ -2352,7 +2354,7 @@ void genesys_init_sensor_tables() ValueFilterAny resolutions; unsigned register_dpihw; unsigned shading_factor; - unsigned output_pixel_offset; + int output_pixel_offset; }; CustomSensorSettings custom_settings[] = { @@ -3144,7 +3146,7 @@ void genesys_init_sensor_tables() ValueFilterAny resolutions; unsigned register_dpihw; unsigned register_dpiset; - unsigned output_pixel_offset; + int output_pixel_offset; }; CustomSensorSettings custom_settings[] = { @@ -3217,7 +3219,7 @@ void genesys_init_sensor_tables() unsigned ccd_size_divisor; unsigned shading_resolution; Ratio pixel_count_ratio; - unsigned output_pixel_offset; + int output_pixel_offset; unsigned exposure_lperiod; unsigned register_dpiset; GenesysRegisterSettingSet custom_fe_regs; @@ -3305,7 +3307,7 @@ void genesys_init_sensor_tables() unsigned ccd_size_divisor; unsigned shading_resolution; Ratio pixel_count_ratio; - unsigned output_pixel_offset; + int output_pixel_offset; unsigned register_dpiset; }; @@ -3360,7 +3362,7 @@ void genesys_init_sensor_tables() { ValueFilterAny resolutions; unsigned register_dpiset; - unsigned output_pixel_offset; + int output_pixel_offset; }; CustomSensorSettings custom_settings[] = { @@ -3430,7 +3432,7 @@ void genesys_init_sensor_tables() unsigned ccd_size_divisor; unsigned shading_resolution; Ratio pixel_count_ratio; - unsigned output_pixel_offset; + int output_pixel_offset; unsigned exposure_lperiod; unsigned register_dpiset; }; @@ -3493,7 +3495,7 @@ void genesys_init_sensor_tables() ValueFilterAny resolutions; ScanMethod method; unsigned register_dpiset; - unsigned output_pixel_offset; + int output_pixel_offset; }; CustomSensorSettings custom_settings[] = { @@ -3667,7 +3669,7 @@ void genesys_init_sensor_tables() unsigned register_dpiset; unsigned shading_resolution; unsigned shading_factor; - unsigned output_pixel_offset; + int output_pixel_offset; }; CustomSensorSettings custom_settings[] = {