genesys: Use output_pixel_offset for CCD offsets on gl845/gl846

merge-requests/213/head^2
Povilas Kanapickas 2020-04-13 07:23:40 +03:00
rodzic e5c46aee41
commit eca7a5ab91
3 zmienionych plików z 34 dodań i 38 usunięć

Wyświetl plik

@ -1012,29 +1012,21 @@ void CommandSetGl846::send_shading_data(Genesys_Device* dev, const Genesys_Senso
uint8_t* data, int size) const
{
DBG_HELPER_ARGS(dbg, "writing %d bytes of shading data", size);
std::uint32_t addr, length, i, pixels;
std::uint32_t addr, i;
uint8_t val,*ptr,*src;
/* shading data is plit in 3 (up to 5 with IR) areas
write(0x10014000,0x00000dd8)
URB 23429 bulk_out len 3544 wrote 0x33 0x10 0x....
write(0x1003e000,0x00000dd8)
write(0x10068000,0x00000dd8)
*/
length = static_cast<uint32_t>(size / 3);
unsigned strpixel = dev->session.pixel_startx;
unsigned endpixel = dev->session.pixel_endx;
unsigned length = static_cast<unsigned>(size / 3);
pixels=endpixel-strpixel;
// we're using SHDAREA, thus we only need to upload part of the line
unsigned offset = dev->session.pixel_count_ratio.apply(
dev->session.params.startx * sensor.optical_res / dev->session.params.xres);
unsigned pixels = dev->session.pixel_count_ratio.apply(dev->session.optical_pixels_raw);
/* since we're using SHDAREA, substract startx coordinate from shading */
strpixel -= (sensor.ccd_start_xoffset * 600) / sensor.optical_res;
// turn pixel value into bytes 2x16 bits words
offset *= 2 * 2;
pixels *= 2 * 2;
/* turn pixel value into bytes 2x16 bits words */
strpixel*=2*2;
pixels*=2*2;
dev->interface->record_key_value("shading_offset", std::to_string(strpixel));
dev->interface->record_key_value("shading_offset", std::to_string(offset));
dev->interface->record_key_value("shading_pixels", std::to_string(pixels));
dev->interface->record_key_value("shading_length", std::to_string(length));
dev->interface->record_key_value("shading_factor", std::to_string(sensor.shading_factor));
@ -1055,8 +1047,8 @@ void CommandSetGl846::send_shading_data(Genesys_Device* dev, const Genesys_Senso
/* iterate on both sensor segment */
for (unsigned x = 0; x < pixels; x += 4 * sensor.shading_factor) {
/* coefficient source */
src=(data+strpixel+i*length)+x;
// coefficient source
src = (data + offset + i * length) + x;
/* coefficient copy */
ptr[0]=src[0];

Wyświetl plik

@ -837,14 +837,14 @@ void compute_session_pixel_offsets(const Genesys_Device* dev, ScanSession& s,
s.pixel_startx = (s.output_startx * s.optical_resolution) / s.params.xres;
s.pixel_endx = s.pixel_startx + s.optical_pixels;
} else if (dev->model->asic_type == AsicType::GL843) {
} else if (dev->model->asic_type == AsicType::GL843 ||
dev->model->asic_type == AsicType::GL845 ||
dev->model->asic_type == AsicType::GL846)
{
s.pixel_startx = s.output_startx * sensor.optical_res / s.params.xres;
s.pixel_endx = s.pixel_startx + s.optical_pixels_raw;
} else if (dev->model->asic_type == AsicType::GL845 ||
dev->model->asic_type == AsicType::GL846 ||
dev->model->asic_type == AsicType::GL847)
{
} else if (dev->model->asic_type == AsicType::GL847) {
unsigned startx = s.params.startx * sensor.optical_res / s.params.xres;
s.pixel_startx = startx;

Wyświetl plik

@ -3372,20 +3372,22 @@ void genesys_init_sensor_tables()
{
ValueFilterAny<unsigned> resolutions;
unsigned register_dpiset;
unsigned output_pixel_offset;
};
CustomSensorSettings custom_settings[] = {
{ { 600 }, 100 },
{ { 1200 }, 200 },
{ { 2400 }, 400 },
{ { 3600 }, 600 },
{ { 7200 }, 1200 },
{ { 600 }, 100, 10 },
{ { 1200 }, 200, 20 },
{ { 2400 }, 400, 40 },
{ { 3600 }, 600, 60 },
{ { 7200 }, 1200, 120 },
};
for (const CustomSensorSettings& setting : custom_settings) {
sensor.resolutions = setting.resolutions;
sensor.shading_resolution = setting.resolutions.values()[0];
sensor.register_dpiset = setting.register_dpiset;
sensor.output_pixel_offset = setting.output_pixel_offset;
s_sensors->push_back(sensor);
}
}
@ -3505,17 +3507,18 @@ void genesys_init_sensor_tables()
ValueFilterAny<unsigned> resolutions;
ScanMethod method;
unsigned register_dpiset;
unsigned output_pixel_offset;
};
CustomSensorSettings custom_settings[] = {
{ { 900 }, ScanMethod::TRANSPARENCY, 150 },
{ { 1800 }, ScanMethod::TRANSPARENCY, 300 },
{ { 3600 }, ScanMethod::TRANSPARENCY, 600 },
{ { 7200 }, ScanMethod::TRANSPARENCY, 1200 },
{ { 900 }, ScanMethod::TRANSPARENCY_INFRARED, 150 },
{ { 1800 }, ScanMethod::TRANSPARENCY_INFRARED, 300 },
{ { 3600 }, ScanMethod::TRANSPARENCY_INFRARED, 600 },
{ { 7200 }, ScanMethod::TRANSPARENCY_INFRARED, 1200 },
{ { 900 }, ScanMethod::TRANSPARENCY, 150, 15 },
{ { 1800 }, ScanMethod::TRANSPARENCY, 300, 30 },
{ { 3600 }, ScanMethod::TRANSPARENCY, 600, 60 },
{ { 7200 }, ScanMethod::TRANSPARENCY, 1200, 120 },
{ { 900 }, ScanMethod::TRANSPARENCY_INFRARED, 150, 15 },
{ { 1800 }, ScanMethod::TRANSPARENCY_INFRARED, 300, 30 },
{ { 3600 }, ScanMethod::TRANSPARENCY_INFRARED, 600, 60 },
{ { 7200 }, ScanMethod::TRANSPARENCY_INFRARED, 1200, 120 },
};
for (const CustomSensorSettings& setting : custom_settings) {
@ -3523,6 +3526,7 @@ void genesys_init_sensor_tables()
sensor.method = setting.method;
sensor.shading_resolution = setting.resolutions.values()[0];
sensor.register_dpiset = setting.register_dpiset;
sensor.output_pixel_offset = setting.output_pixel_offset;
s_sensors->push_back(sensor);
}
}