diff --git a/backend/genesys.cc b/backend/genesys.cc index d7a0c0bde..eef13e704 100644 --- a/backend/genesys.cc +++ b/backend/genesys.cc @@ -3484,7 +3484,7 @@ static void genesys_fill_segmented_buffer(Genesys_Device* dev, uint8_t* work_buf k = count + (i * dev->session.segment_count) / 8; for (unsigned n = 0; n < dev->session.segment_count; n++) { work_buffer_dst[k] = work_buffer_dst[k] << 1; - if ((dev->oe_buffer.get_read_pos()[dev->deseg.curr_byte + dev->deseg.skip_bytes + dev->session.conseq_pixel_dist_bytes * dev->segment_order[n]])&(128>>i)) { + if ((dev->oe_buffer.get_read_pos()[dev->deseg.curr_byte + dev->session.output_segment_start_offset + dev->session.conseq_pixel_dist_bytes * dev->segment_order[n]])&(128>>i)) { work_buffer_dst[k] |= 1; } } @@ -3498,7 +3498,7 @@ static void genesys_fill_segmented_buffer(Genesys_Device* dev, uint8_t* work_buf if (depth==8) { while (dev->deseg.curr_byte < dev->session.output_segment_pixel_group_count && count < size) { for (unsigned n = 0; n < dev->session.segment_count; n++) { - work_buffer_dst[count+n] = dev->oe_buffer.get_read_pos()[dev->deseg.curr_byte + dev->deseg.skip_bytes + dev->session.conseq_pixel_dist_bytes *dev->segment_order[n]]; + work_buffer_dst[count+n] = dev->oe_buffer.get_read_pos()[dev->deseg.curr_byte + dev->session.output_segment_start_offset + dev->session.conseq_pixel_dist_bytes *dev->segment_order[n]]; } /* update counter and pointer */ count += dev->session.segment_count; @@ -3508,8 +3508,8 @@ static void genesys_fill_segmented_buffer(Genesys_Device* dev, uint8_t* work_buf if (depth==16) { while (dev->deseg.curr_byte < dev->session.output_segment_pixel_group_count && count < size) { for (unsigned n = 0; n < dev->session.segment_count; n++) { - work_buffer_dst[count+n*2] = dev->oe_buffer.get_read_pos()[dev->deseg.curr_byte + dev->deseg.skip_bytes + dev->session.conseq_pixel_dist_bytes * dev->segment_order[n]]; - work_buffer_dst[count+n*2+1] = dev->oe_buffer.get_read_pos()[dev->deseg.curr_byte + dev->deseg.skip_bytes + dev->session.conseq_pixel_dist_bytes * dev->segment_order[n] + 1]; + work_buffer_dst[count+n*2] = dev->oe_buffer.get_read_pos()[dev->deseg.curr_byte + dev->session.output_segment_start_offset + dev->session.conseq_pixel_dist_bytes * dev->segment_order[n]]; + work_buffer_dst[count+n*2+1] = dev->oe_buffer.get_read_pos()[dev->deseg.curr_byte + dev->session.output_segment_start_offset + dev->session.conseq_pixel_dist_bytes * dev->segment_order[n] + 1]; } /* update counter and pointer */ count += dev->session.segment_count * 2; diff --git a/backend/genesys_device.h b/backend/genesys_device.h index 7720ff45d..d770d7ee8 100644 --- a/backend/genesys_device.h +++ b/backend/genesys_device.h @@ -195,9 +195,6 @@ struct Genesys_Model // Describes the geometry of the raw data coming out of the scanner for desegmentation. struct DesegmentationState { - // The number of bytes to skip at start of line. Currently it's always zero. - unsigned skip_bytes = 0; - // The current byte during desegmentation process unsigned curr_byte = 0; }; diff --git a/backend/genesys_gl124.cc b/backend/genesys_gl124.cc index e8cc78256..f11d81663 100644 --- a/backend/genesys_gl124.cc +++ b/backend/genesys_gl124.cc @@ -946,7 +946,6 @@ static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens DBG(DBG_io2, "%s: endpixel used=%d\n", __func__, endx / session.segment_count); dev->deseg.curr_byte = 0; - dev->deseg.skip_bytes = 0; dev->line_count = 0; dev->line_interp = 0; diff --git a/backend/genesys_gl846.cc b/backend/genesys_gl846.cc index f6ee22e4e..f601c4be7 100644 --- a/backend/genesys_gl846.cc +++ b/backend/genesys_gl846.cc @@ -712,7 +712,6 @@ static void gl846_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens // compute pixel coordinate in the given dpihw space, taking segments into account startx /= session.hwdpi_divisor * session.segment_count; endx /= session.hwdpi_divisor * session.segment_count; - dev->deseg.skip_bytes = 0; gl846_set_fe(dev, sensor, AFE_SET); diff --git a/backend/genesys_gl847.cc b/backend/genesys_gl847.cc index ab12a32fa..0da931dd3 100644 --- a/backend/genesys_gl847.cc +++ b/backend/genesys_gl847.cc @@ -729,7 +729,6 @@ static void gl847_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens // compute pixel coordinate in the given dpihw space, taking segments into account startx /= session.hwdpi_divisor * session.segment_count; endx /= session.hwdpi_divisor * session.segment_count; - dev->deseg.skip_bytes = 0; gl847_set_fe(dev, sensor, AFE_SET); diff --git a/backend/genesys_settings.h b/backend/genesys_settings.h index 3ef7f059c..659e2e909 100644 --- a/backend/genesys_settings.h +++ b/backend/genesys_settings.h @@ -281,6 +281,10 @@ struct ScanSession { // only on gl124, gl846, gl847 unsigned output_segment_pixel_group_count = 0; + // The number of bytes to skip at start of line during desegmentation. + // Currently it's always zero. + unsigned output_segment_start_offset = 0; + // the sizes of the corresponding buffers size_t buffer_size_read = 0; size_t buffer_size_lines = 0;