genesys: Remove the desegmentation state struct

merge-requests/169/head
Povilas Kanapickas 2019-09-12 22:22:00 +03:00
rodzic 3d023060a3
commit 0267eeeeae
5 zmienionych plików z 21 dodań i 27 usunięć

Wyświetl plik

@ -3424,17 +3424,17 @@ static void genesys_fill_line_interp_buffer(Genesys_Device* dev, uint8_t* work_b
// dev->line_interp holds the number of lines scanned for one line of data sent
if (((dev->line_count / dev->session.params.channels) % dev->line_interp) == 0) {
/* copy pixel when line matches */
work_buffer_dst[count] = dev->oe_buffer.get_read_pos()[dev->deseg.curr_byte];
work_buffer_dst[count] = dev->oe_buffer.get_read_pos()[dev->deseg_curr_byte];
count++;
}
// always update pointer so we skip uncopied data
dev->deseg.curr_byte++;
dev->deseg_curr_byte++;
/* go to next line if needed */
if (dev->deseg.curr_byte == dev->session.output_segment_pixel_group_count) {
if (dev->deseg_curr_byte == dev->session.output_segment_pixel_group_count) {
dev->oe_buffer.set_pos(dev->oe_buffer.pos() + dev->session.output_line_bytes_raw);
dev->deseg.curr_byte = 0;
dev->deseg_curr_byte = 0;
dev->line_count++;
}
@ -3475,7 +3475,7 @@ static void genesys_fill_segmented_buffer(Genesys_Device* dev, uint8_t* work_buf
while (count < size)
{
if (depth==1) {
while (dev->deseg.curr_byte < dev->session.output_segment_pixel_group_count && count < size) {
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] = 0;
}
@ -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->session.output_segment_start_offset + 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;
}
}
@ -3492,35 +3492,35 @@ static void genesys_fill_segmented_buffer(Genesys_Device* dev, uint8_t* work_buf
/* update counter and pointer */
count += dev->session.segment_count;
dev->deseg.curr_byte++;
dev->deseg_curr_byte++;
}
}
if (depth==8) {
while (dev->deseg.curr_byte < dev->session.output_segment_pixel_group_count && count < size) {
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->session.output_segment_start_offset + 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;
dev->deseg.curr_byte++;
dev->deseg_curr_byte++;
}
}
if (depth==16) {
while (dev->deseg.curr_byte < dev->session.output_segment_pixel_group_count && count < size) {
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->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];
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;
dev->deseg.curr_byte += 2;
dev->deseg_curr_byte += 2;
}
}
/* go to next line if needed */
if (dev->deseg.curr_byte == dev->session.output_segment_pixel_group_count) {
if (dev->deseg_curr_byte == dev->session.output_segment_pixel_group_count) {
dev->oe_buffer.set_pos(dev->oe_buffer.pos() + dev->session.output_line_bytes_raw);
dev->deseg.curr_byte = 0;
dev->deseg_curr_byte = 0;
}
/* read a new buffer if needed */

Wyświetl plik

@ -192,13 +192,6 @@ struct Genesys_Model
}
};
// Describes the geometry of the raw data coming out of the scanner for desegmentation.
struct DesegmentationState
{
// The current byte during desegmentation process
unsigned curr_byte = 0;
};
/**
* Describes the current device status for the backend
* session. This should be more accurately called
@ -299,7 +292,8 @@ struct Genesys_Device
// total bytes read to be sent to frontend
size_t total_bytes_to_read = 0;
DesegmentationState deseg;
// The current byte during desegmentation process
size_t deseg_curr_byte = 0;
// contains the real used values
Genesys_Current_Setup current_setup;

Wyświetl plik

@ -945,7 +945,7 @@ static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
reg->set24(REG_ENDPIXEL, endx / session.segment_count);
DBG(DBG_io2, "%s: endpixel used=%d\n", __func__, endx / session.segment_count);
dev->deseg.curr_byte = 0;
dev->deseg_curr_byte = 0;
dev->line_count = 0;
dev->line_interp = 0;

Wyświetl plik

@ -807,7 +807,7 @@ static void gl846_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
}*/
}
dev->deseg.curr_byte = 0;
dev->deseg_curr_byte = 0;
dev->line_interp = 0;
unsigned dpiset = session.params.xres * ccd_pixels_per_system_pixel;

Wyświetl plik

@ -824,7 +824,7 @@ static void gl847_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
}*/
}
dev->deseg.curr_byte = 0;
dev->deseg_curr_byte = 0;
dev->line_interp = 0;
unsigned dpiset = session.params.xres * ccd_pixels_per_system_pixel;