kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Simplify shading data upload on gl841
rodzic
459c62c131
commit
d9cd672a43
|
@ -1117,23 +1117,6 @@ HOME_FREE: 3
|
||||||
r->value = (fast_table.steps_count >> 1) + (fast_table.steps_count & 1);
|
r->value = (fast_table.steps_count >> 1) + (fast_table.steps_count & 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
gl841_get_dpihw(Genesys_Device * dev)
|
|
||||||
{
|
|
||||||
GenesysRegister* r;
|
|
||||||
r = sanei_genesys_get_address(&dev->reg, 0x05);
|
|
||||||
if ((r->value & REG_0x05_DPIHW) == REG_0x05_DPIHW_600) {
|
|
||||||
return 600;
|
|
||||||
}
|
|
||||||
if ((r->value & REG_0x05_DPIHW) == REG_0x05_DPIHW_1200) {
|
|
||||||
return 1200;
|
|
||||||
}
|
|
||||||
if ((r->value & REG_0x05_DPIHW) == REG_0x05_DPIHW_2400) {
|
|
||||||
return 2400;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void gl841_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
static void gl841_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||||
Genesys_Register_Set* reg, unsigned int exposure_time,
|
Genesys_Register_Set* reg, unsigned int exposure_time,
|
||||||
const ScanSession& session)
|
const ScanSession& session)
|
||||||
|
@ -3059,7 +3042,7 @@ void CommandSetGl841::send_shading_data(Genesys_Device* dev, const Genesys_Senso
|
||||||
{
|
{
|
||||||
DBG_HELPER_ARGS(dbg, "writing %d bytes of shading data", size);
|
DBG_HELPER_ARGS(dbg, "writing %d bytes of shading data", size);
|
||||||
uint32_t length, x, pixels, i;
|
uint32_t length, x, pixels, i;
|
||||||
uint16_t dpihw, beginpixel;
|
std::uint16_t beginpixel;
|
||||||
uint8_t *ptr,*src;
|
uint8_t *ptr,*src;
|
||||||
|
|
||||||
/* old method if no SHDAREA */
|
/* old method if no SHDAREA */
|
||||||
|
@ -3073,13 +3056,6 @@ void CommandSetGl841::send_shading_data(Genesys_Device* dev, const Genesys_Senso
|
||||||
unsigned strpixel = dev->session.pixel_startx;
|
unsigned strpixel = dev->session.pixel_startx;
|
||||||
unsigned endpixel = dev->session.pixel_endx;
|
unsigned endpixel = dev->session.pixel_endx;
|
||||||
|
|
||||||
/* compute deletion/average factor */
|
|
||||||
dpihw = gl841_get_dpihw(dev);
|
|
||||||
unsigned ccd_size_divisor = dev->session.ccd_size_divisor;
|
|
||||||
unsigned factor = dpihw / sensor.dpiset_override;
|
|
||||||
DBG(DBG_io2, "%s: dpihw=%d, ccd_size_divisor=%d, factor=%d\n", __func__, dpihw,
|
|
||||||
ccd_size_divisor, factor);
|
|
||||||
|
|
||||||
/* turn pixel value into bytes 2x16 bits words */
|
/* turn pixel value into bytes 2x16 bits words */
|
||||||
strpixel*=2*2; /* 2 words of 2 bytes */
|
strpixel*=2*2; /* 2 words of 2 bytes */
|
||||||
endpixel*=2*2;
|
endpixel*=2*2;
|
||||||
|
@ -3088,10 +3064,10 @@ void CommandSetGl841::send_shading_data(Genesys_Device* dev, const Genesys_Senso
|
||||||
/* shading pixel begin is start pixel minus start pixel during shading
|
/* shading pixel begin is start pixel minus start pixel during shading
|
||||||
* calibration. Currently only cases handled are full and half ccd resolution.
|
* calibration. Currently only cases handled are full and half ccd resolution.
|
||||||
*/
|
*/
|
||||||
beginpixel = sensor.ccd_start_xoffset / ccd_size_divisor;
|
beginpixel = sensor.ccd_start_xoffset / dev->session.ccd_size_divisor;
|
||||||
beginpixel += sensor.dummy_pixel + 1;
|
beginpixel += sensor.dummy_pixel + 1;
|
||||||
DBG(DBG_io2, "%s: ORIGIN PIXEL=%d\n", __func__, beginpixel);
|
DBG(DBG_io2, "%s: ORIGIN PIXEL=%d\n", __func__, beginpixel);
|
||||||
beginpixel = (strpixel-beginpixel*2*2)/factor;
|
beginpixel = (strpixel - beginpixel * 2 * 2) / sensor.shading_factor;
|
||||||
DBG(DBG_io2, "%s: BEGIN PIXEL=%d\n", __func__, beginpixel/4);
|
DBG(DBG_io2, "%s: BEGIN PIXEL=%d\n", __func__, beginpixel/4);
|
||||||
|
|
||||||
dev->interface->record_key_value("shading_offset", std::to_string(beginpixel));
|
dev->interface->record_key_value("shading_offset", std::to_string(beginpixel));
|
||||||
|
|
|
@ -3352,22 +3352,24 @@ void genesys_init_sensor_tables()
|
||||||
ValueFilterAny<unsigned> resolutions;
|
ValueFilterAny<unsigned> resolutions;
|
||||||
unsigned dpiset_override;
|
unsigned dpiset_override;
|
||||||
unsigned shading_resolution;
|
unsigned shading_resolution;
|
||||||
|
unsigned shading_factor;
|
||||||
};
|
};
|
||||||
|
|
||||||
CustomSensorSettings custom_settings[] = {
|
CustomSensorSettings custom_settings[] = {
|
||||||
{ { 75 }, 150, 600 },
|
{ { 75 }, 150, 600, 8 },
|
||||||
{ { 100 }, 200, 600 },
|
{ { 100 }, 200, 600, 6 },
|
||||||
{ { 150 }, 300, 600 },
|
{ { 150 }, 300, 600, 4 },
|
||||||
{ { 200 }, 400, 600 },
|
{ { 200 }, 400, 600, 3 },
|
||||||
{ { 300 }, 600, 600 },
|
{ { 300 }, 600, 600, 2 },
|
||||||
{ { 600 }, 1200, 600 },
|
{ { 600 }, 1200, 600, 1 },
|
||||||
{ { 1200 }, 1200, 1200 },
|
{ { 1200 }, 1200, 1200, 1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const CustomSensorSettings& setting : custom_settings) {
|
for (const CustomSensorSettings& setting : custom_settings) {
|
||||||
sensor.resolutions = setting.resolutions;
|
sensor.resolutions = setting.resolutions;
|
||||||
sensor.dpiset_override = setting.dpiset_override;
|
sensor.dpiset_override = setting.dpiset_override;
|
||||||
sensor.shading_resolution = setting.shading_resolution;
|
sensor.shading_resolution = setting.shading_resolution;
|
||||||
|
sensor.shading_factor = setting.shading_factor;
|
||||||
s_sensors->push_back(sensor);
|
s_sensors->push_back(sensor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue