kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Simplify calculation of shading upload parameters on gl845/846
rodzic
6e3713c87d
commit
028c9d398f
|
@ -905,8 +905,7 @@ 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);
|
||||
uint32_t addr, length, i, x, factor, pixels;
|
||||
uint32_t dpiset, dpihw;
|
||||
std::uint32_t addr, length, i, pixels;
|
||||
uint8_t val,*ptr,*src;
|
||||
|
||||
/* shading data is plit in 3 (up to 5 with IR) areas
|
||||
|
@ -919,12 +918,6 @@ void CommandSetGl846::send_shading_data(Genesys_Device* dev, const Genesys_Senso
|
|||
unsigned strpixel = dev->session.pixel_startx;
|
||||
unsigned endpixel = dev->session.pixel_endx;
|
||||
|
||||
/* compute deletion factor */
|
||||
dpiset = dev->reg.get16(REG_DPISET);
|
||||
dpihw = sensor.get_register_hwdpi(dpiset);
|
||||
factor=dpihw/dpiset;
|
||||
DBG(DBG_io2, "%s: factor=%d\n", __func__, factor);
|
||||
|
||||
pixels=endpixel-strpixel;
|
||||
|
||||
/* since we're using SHDAREA, substract startx coordinate from shading */
|
||||
|
@ -937,7 +930,7 @@ void CommandSetGl846::send_shading_data(Genesys_Device* dev, const Genesys_Senso
|
|||
dev->interface->record_key_value("shading_offset", std::to_string(strpixel));
|
||||
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(factor));
|
||||
dev->interface->record_key_value("shading_factor", std::to_string(sensor.shading_factor));
|
||||
|
||||
std::vector<uint8_t> buffer(pixels, 0);
|
||||
|
||||
|
@ -954,8 +947,7 @@ void CommandSetGl846::send_shading_data(Genesys_Device* dev, const Genesys_Senso
|
|||
ptr = buffer.data();
|
||||
|
||||
/* iterate on both sensor segment */
|
||||
for(x=0;x<pixels;x+=4*factor)
|
||||
{
|
||||
for (unsigned x = 0; x < pixels; x += 4 * sensor.shading_factor) {
|
||||
/* coefficient source */
|
||||
src=(data+strpixel+i*length)+x;
|
||||
|
||||
|
|
|
@ -3009,16 +3009,22 @@ void genesys_init_sensor_tables()
|
|||
{
|
||||
ValueFilterAny<unsigned> resolutions;
|
||||
Ratio pixel_count_ratio;
|
||||
unsigned shading_factor;
|
||||
};
|
||||
|
||||
CustomSensorSettings custom_settings[] = {
|
||||
{ { 75, 100, 150, 300, 600 }, Ratio{1, 4} },
|
||||
{ { 1200 }, Ratio{1, 2} },
|
||||
{ { 75 }, Ratio{1, 4}, 8 },
|
||||
{ { 100 }, Ratio{1, 4}, 6 },
|
||||
{ { 150 }, Ratio{1, 4}, 4 },
|
||||
{ { 300 }, Ratio{1, 4}, 2 },
|
||||
{ { 600 }, Ratio{1, 4}, 1 },
|
||||
{ { 1200 }, Ratio{1, 2}, 1 },
|
||||
};
|
||||
|
||||
for (const CustomSensorSettings& setting : custom_settings) {
|
||||
sensor.resolutions = setting.resolutions;
|
||||
sensor.pixel_count_ratio = setting.pixel_count_ratio;
|
||||
sensor.shading_factor = setting.shading_factor;
|
||||
s_sensors->push_back(sensor);
|
||||
}
|
||||
}
|
||||
|
@ -3052,16 +3058,22 @@ void genesys_init_sensor_tables()
|
|||
{
|
||||
ValueFilterAny<unsigned> resolutions;
|
||||
Ratio pixel_count_ratio;
|
||||
unsigned shading_factor;
|
||||
};
|
||||
|
||||
CustomSensorSettings custom_settings[] = {
|
||||
{ { 75, 100, 150, 300, 600 }, Ratio{1, 2} },
|
||||
{ { 1200 }, Ratio{1, 1} },
|
||||
{ { 75 }, Ratio{1, 2}, 8 },
|
||||
{ { 100 }, Ratio{1, 2}, 6 },
|
||||
{ { 150 }, Ratio{1, 2}, 4 },
|
||||
{ { 300 }, Ratio{1, 2}, 2 },
|
||||
{ { 600 }, Ratio{1, 2}, 1 },
|
||||
{ { 1200 }, Ratio{1, 1}, 1 },
|
||||
};
|
||||
|
||||
for (const CustomSensorSettings& setting : custom_settings) {
|
||||
sensor.resolutions = setting.resolutions;
|
||||
sensor.pixel_count_ratio = setting.pixel_count_ratio;
|
||||
sensor.shading_factor = setting.shading_factor;
|
||||
s_sensors->push_back(sensor);
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue