kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Move Genesys_Device::curr to DesegmentationState
rodzic
f92253adc8
commit
676831dc7b
|
@ -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
|
// 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) {
|
if (((dev->line_count / dev->session.params.channels) % dev->line_interp) == 0) {
|
||||||
/* copy pixel when line matches */
|
/* copy pixel when line matches */
|
||||||
work_buffer_dst[count] = dev->oe_buffer.get_read_pos()[dev->cur];
|
work_buffer_dst[count] = dev->oe_buffer.get_read_pos()[dev->deseg.curr_byte];
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* always update pointer so we skip uncopied data */
|
// always update pointer so we skip uncopied data
|
||||||
dev->cur++;
|
dev->deseg.curr_byte++;
|
||||||
|
|
||||||
/* go to next line if needed */
|
/* go to next line if needed */
|
||||||
if (dev->cur == dev->deseg.pixel_groups) {
|
if (dev->deseg.curr_byte == dev->deseg.pixel_groups) {
|
||||||
dev->oe_buffer.set_pos(dev->oe_buffer.pos() + dev->deseg.raw_channel_bytes);
|
dev->oe_buffer.set_pos(dev->oe_buffer.pos() + dev->deseg.raw_channel_bytes);
|
||||||
dev->cur = 0;
|
dev->deseg.curr_byte = 0;
|
||||||
dev->line_count++;
|
dev->line_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3475,7 +3475,7 @@ static void genesys_fill_segmented_buffer(Genesys_Device* dev, uint8_t* work_buf
|
||||||
while (count < size)
|
while (count < size)
|
||||||
{
|
{
|
||||||
if (depth==1) {
|
if (depth==1) {
|
||||||
while (dev->cur < dev->deseg.pixel_groups && count < size) {
|
while (dev->deseg.curr_byte < dev->deseg.pixel_groups && count < size) {
|
||||||
for (unsigned n = 0; n < dev->deseg.segment_count; n++) {
|
for (unsigned n = 0; n < dev->deseg.segment_count; n++) {
|
||||||
work_buffer_dst[count+n] = 0;
|
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->deseg.segment_count) / 8;
|
k = count + (i * dev->deseg.segment_count) / 8;
|
||||||
for (unsigned n = 0; n < dev->deseg.segment_count; n++) {
|
for (unsigned n = 0; n < dev->deseg.segment_count; n++) {
|
||||||
work_buffer_dst[k] = work_buffer_dst[k] << 1;
|
work_buffer_dst[k] = work_buffer_dst[k] << 1;
|
||||||
if ((dev->oe_buffer.get_read_pos()[dev->cur + dev->deseg.skip_bytes + dev->deseg.conseq_pixel_dist_bytes * dev->segment_order[n]])&(128>>i)) {
|
if ((dev->oe_buffer.get_read_pos()[dev->deseg.curr_byte + dev->deseg.skip_bytes + dev->deseg.conseq_pixel_dist_bytes * dev->segment_order[n]])&(128>>i)) {
|
||||||
work_buffer_dst[k] |= 1;
|
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 */
|
/* update counter and pointer */
|
||||||
count += dev->deseg.segment_count;
|
count += dev->deseg.segment_count;
|
||||||
dev->cur++;
|
dev->deseg.curr_byte++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (depth==8) {
|
if (depth==8) {
|
||||||
while (dev->cur < dev->deseg.pixel_groups && count < size) {
|
while (dev->deseg.curr_byte < dev->deseg.pixel_groups && count < size) {
|
||||||
for (unsigned n = 0; n < dev->deseg.segment_count; n++) {
|
for (unsigned n = 0; n < dev->deseg.segment_count; n++) {
|
||||||
work_buffer_dst[count+n] = dev->oe_buffer.get_read_pos()[dev->cur + dev->deseg.skip_bytes + dev->deseg.conseq_pixel_dist_bytes *dev->segment_order[n]];
|
work_buffer_dst[count+n] = dev->oe_buffer.get_read_pos()[dev->deseg.curr_byte + dev->deseg.skip_bytes + dev->deseg.conseq_pixel_dist_bytes *dev->segment_order[n]];
|
||||||
}
|
}
|
||||||
/* update counter and pointer */
|
/* update counter and pointer */
|
||||||
count += dev->deseg.segment_count;
|
count += dev->deseg.segment_count;
|
||||||
dev->cur++;
|
dev->deseg.curr_byte++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (depth==16) {
|
if (depth==16) {
|
||||||
while (dev->cur < dev->deseg.pixel_groups && count < size) {
|
while (dev->deseg.curr_byte < dev->deseg.pixel_groups && count < size) {
|
||||||
for (unsigned n = 0; n < dev->deseg.segment_count; n++) {
|
for (unsigned n = 0; n < dev->deseg.segment_count; n++) {
|
||||||
work_buffer_dst[count+n*2] = dev->oe_buffer.get_read_pos()[dev->cur + dev->deseg.skip_bytes + dev->deseg.conseq_pixel_dist_bytes * dev->segment_order[n]];
|
work_buffer_dst[count+n*2] = dev->oe_buffer.get_read_pos()[dev->deseg.curr_byte + dev->deseg.skip_bytes + dev->deseg.conseq_pixel_dist_bytes * dev->segment_order[n]];
|
||||||
work_buffer_dst[count+n*2+1] = dev->oe_buffer.get_read_pos()[dev->cur + dev->deseg.skip_bytes + dev->deseg.conseq_pixel_dist_bytes * dev->segment_order[n] + 1];
|
work_buffer_dst[count+n*2+1] = dev->oe_buffer.get_read_pos()[dev->deseg.curr_byte + dev->deseg.skip_bytes + dev->deseg.conseq_pixel_dist_bytes * dev->segment_order[n] + 1];
|
||||||
}
|
}
|
||||||
/* update counter and pointer */
|
/* update counter and pointer */
|
||||||
count += dev->deseg.segment_count * 2;
|
count += dev->deseg.segment_count * 2;
|
||||||
dev->cur+=2;
|
dev->deseg.curr_byte += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* go to next line if needed */
|
/* go to next line if needed */
|
||||||
if (dev->cur == dev->deseg.pixel_groups) {
|
if (dev->deseg.curr_byte == dev->deseg.pixel_groups) {
|
||||||
dev->oe_buffer.set_pos(dev->oe_buffer.pos() + dev->deseg.raw_channel_bytes);
|
dev->oe_buffer.set_pos(dev->oe_buffer.pos() + dev->deseg.raw_channel_bytes);
|
||||||
dev->cur = 0;
|
dev->deseg.curr_byte = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read a new buffer if needed */
|
/* read a new buffer if needed */
|
||||||
|
|
|
@ -214,6 +214,9 @@ struct DesegmentationState
|
||||||
|
|
||||||
// Total bytes in a line received from a scanner
|
// Total bytes in a line received from a scanner
|
||||||
unsigned raw_line_bytes = 0;
|
unsigned raw_line_bytes = 0;
|
||||||
|
|
||||||
|
// The current byte during desegmentation process
|
||||||
|
unsigned curr_byte = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -338,8 +341,6 @@ struct Genesys_Device
|
||||||
int line_interp = 0;
|
int line_interp = 0;
|
||||||
// number of scan lines used during scan
|
// number of scan lines used during scan
|
||||||
int line_count = 0;
|
int line_count = 0;
|
||||||
// current pixel position within sub window
|
|
||||||
size_t cur = 0;
|
|
||||||
|
|
||||||
// array describing the order of the sub-segments of the sensor
|
// array describing the order of the sub-segments of the sensor
|
||||||
std::vector<unsigned> segment_order;
|
std::vector<unsigned> segment_order;
|
||||||
|
|
|
@ -994,7 +994,7 @@ static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
||||||
multiply_by_depth_ceil(session.output_pixels / session.ccd_size_divisor,
|
multiply_by_depth_ceil(session.output_pixels / session.ccd_size_divisor,
|
||||||
session.params.depth);
|
session.params.depth);
|
||||||
|
|
||||||
dev->cur = 0;
|
dev->deseg.curr_byte = 0;
|
||||||
dev->deseg.skip_bytes = 0;
|
dev->deseg.skip_bytes = 0;
|
||||||
dev->deseg.pixel_groups = dev->deseg.raw_channel_bytes / segment_count;
|
dev->deseg.pixel_groups = dev->deseg.raw_channel_bytes / segment_count;
|
||||||
dev->deseg.conseq_pixel_dist_bytes = dev->deseg.raw_channel_bytes / segment_count;
|
dev->deseg.conseq_pixel_dist_bytes = dev->deseg.raw_channel_bytes / segment_count;
|
||||||
|
|
|
@ -871,7 +871,7 @@ static void gl846_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
||||||
dev->deseg.pixel_groups = multiply_by_depth_ceil(dev->deseg.pixel_groups, session.params.depth);
|
dev->deseg.pixel_groups = multiply_by_depth_ceil(dev->deseg.pixel_groups, session.params.depth);
|
||||||
dev->deseg.conseq_pixel_dist_bytes = multiply_by_depth_ceil(dev->deseg.conseq_pixel_dist_bytes, session.params.depth);
|
dev->deseg.conseq_pixel_dist_bytes = multiply_by_depth_ceil(dev->deseg.conseq_pixel_dist_bytes, session.params.depth);
|
||||||
|
|
||||||
dev->cur=0;
|
dev->deseg.curr_byte = 0;
|
||||||
dev->deseg.segment_count = segment_count;
|
dev->deseg.segment_count = segment_count;
|
||||||
dev->line_interp = 0;
|
dev->line_interp = 0;
|
||||||
|
|
||||||
|
|
|
@ -890,7 +890,7 @@ static void gl847_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
||||||
dev->deseg.pixel_groups = multiply_by_depth_ceil(dev->deseg.pixel_groups, session.params.depth);
|
dev->deseg.pixel_groups = multiply_by_depth_ceil(dev->deseg.pixel_groups, session.params.depth);
|
||||||
dev->deseg.conseq_pixel_dist_bytes = multiply_by_depth_ceil(dev->deseg.conseq_pixel_dist_bytes, session.params.depth);
|
dev->deseg.conseq_pixel_dist_bytes = multiply_by_depth_ceil(dev->deseg.conseq_pixel_dist_bytes, session.params.depth);
|
||||||
|
|
||||||
dev->cur=0;
|
dev->deseg.curr_byte = 0;
|
||||||
dev->deseg.segment_count = segment_count;
|
dev->deseg.segment_count = segment_count;
|
||||||
dev->line_interp = 0;
|
dev->line_interp = 0;
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue