genesys: Move Genesys_Device::skip to DesegmentationState

merge-requests/162/head
Povilas Kanapickas 2019-09-12 21:26:55 +03:00
rodzic 9bd14f5350
commit 31820384de
5 zmienionych plików z 10 dodań i 9 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->segnb)/8;
for (n=0;n<dev->segnb;n++) {
work_buffer_dst[k] = work_buffer_dst[k] << 1;
if ((dev->oe_buffer.get_read_pos()[dev->cur + dev->skip + dev->deseg.conseq_pixel_dist_bytes * dev->segment_order[n]])&(128>>i)) {
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)) {
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->cur < dev->deseg.pixel_groups && count < size) {
for (n=0;n<dev->segnb;n++) {
work_buffer_dst[count+n] = dev->oe_buffer.get_read_pos()[dev->cur + dev->skip + dev->deseg.conseq_pixel_dist_bytes *dev->segment_order[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]];
}
/* update counter and pointer */
count += dev->segnb;
@ -3508,8 +3508,8 @@ static void genesys_fill_segmented_buffer(Genesys_Device* dev, uint8_t* work_buf
if (depth==16) {
while (dev->cur < dev->deseg.pixel_groups && count < size) {
for (n=0;n<dev->segnb;n++) {
work_buffer_dst[count+n*2] = dev->oe_buffer.get_read_pos()[dev->cur + dev->skip + 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->skip + dev->deseg.conseq_pixel_dist_bytes * dev->segment_order[n] + 1];
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+1] = dev->oe_buffer.get_read_pos()[dev->cur + dev->deseg.skip_bytes + dev->deseg.conseq_pixel_dist_bytes * dev->segment_order[n] + 1];
}
/* update counter and pointer */
count += dev->segnb*2;

Wyświetl plik

@ -195,6 +195,9 @@ 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 number of "even" pixels to scan. This corresponds to the number of pixels that will be
// scanned from a single segment
unsigned pixel_groups = 0;
@ -336,8 +339,6 @@ struct Genesys_Device
int line_count = 0;
// current pixel position within sub window
size_t cur = 0;
// number of bytes to skip at start of line
size_t skip = 0;
// array describing the order of the sub-segments of the sensor
std::vector<unsigned> segment_order;

Wyświetl plik

@ -996,7 +996,7 @@ static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
session.params.depth);
dev->cur = 0;
dev->skip = 0;
dev->deseg.skip_bytes = 0;
dev->deseg.pixel_groups = dev->deseg.raw_channel_bytes / segnb;
dev->deseg.conseq_pixel_dist_bytes = dev->deseg.raw_channel_bytes / segnb;
dev->segnb = segnb;

Wyświetl plik

@ -763,7 +763,7 @@ static void gl846_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
endx /= factor*segnb;
dev->deseg.pixel_groups = endx - startx;
dev->deseg.conseq_pixel_dist_bytes = 0;
dev->skip=0;
dev->deseg.skip_bytes = 0;
/* in cas of multi-segments sensor, we have to add the witdh
* of the sensor crossed by the scan area */

Wyświetl plik

@ -782,7 +782,7 @@ static void gl847_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
endx /= factor*segnb;
dev->deseg.pixel_groups = endx-startx;
dev->deseg.conseq_pixel_dist_bytes = 0;
dev->skip=0;
dev->deseg.skip_bytes = 0;
/* in cas of multi-segments sensor, we have to add the witdh
* of the sensor crossed by the scan area */