genesys: Move desegmentation skip_bytes to session struct

merge-requests/169/head
Povilas Kanapickas 2019-09-12 22:21:59 +03:00
rodzic 192dd886cd
commit 3d023060a3
6 zmienionych plików z 8 dodań i 10 usunięć

Wyświetl plik

@ -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;

Wyświetl plik

@ -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;
};

Wyświetl plik

@ -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;

Wyświetl plik

@ -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);

Wyświetl plik

@ -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);

Wyświetl plik

@ -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;