kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Use unsigned for resolution in various places
rodzic
59e356ac13
commit
f4a2957541
|
@ -216,7 +216,7 @@ bool sanei_genesys_has_sensor(Genesys_Device* dev, unsigned dpi, unsigned channe
|
|||
return find_sensor_impl(dev, dpi, channels, scan_method) != nullptr;
|
||||
}
|
||||
|
||||
const Genesys_Sensor& sanei_genesys_find_sensor(Genesys_Device* dev, int dpi, unsigned channels,
|
||||
const Genesys_Sensor& sanei_genesys_find_sensor(Genesys_Device* dev, unsigned dpi, unsigned channels,
|
||||
ScanMethod scan_method)
|
||||
{
|
||||
const auto* sensor = find_sensor_impl(dev, dpi, channels, scan_method);
|
||||
|
@ -225,7 +225,7 @@ const Genesys_Sensor& sanei_genesys_find_sensor(Genesys_Device* dev, int dpi, un
|
|||
throw std::runtime_error("Given device does not have sensor defined");
|
||||
}
|
||||
|
||||
Genesys_Sensor& sanei_genesys_find_sensor_for_write(Genesys_Device* dev, int dpi,
|
||||
Genesys_Sensor& sanei_genesys_find_sensor_for_write(Genesys_Device* dev, unsigned dpi,
|
||||
unsigned channels,
|
||||
ScanMethod scan_method)
|
||||
{
|
||||
|
@ -4478,7 +4478,7 @@ probe_genesys_devices (void)
|
|||
of Genesys_Calibration_Cache as is.
|
||||
*/
|
||||
static const char* CALIBRATION_IDENT = "sane_genesys";
|
||||
static const int CALIBRATION_VERSION = 14;
|
||||
static const int CALIBRATION_VERSION = 15;
|
||||
|
||||
bool read_calibration(std::istream& str, Genesys_Device::Calibration& calibration,
|
||||
const std::string& path)
|
||||
|
|
|
@ -481,7 +481,7 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
|
|||
const Genesys_Sensor& sensor,
|
||||
Genesys_Register_Set* reg,
|
||||
unsigned int scan_exposure_time,
|
||||
float scan_yres,
|
||||
unsigned scan_yres,
|
||||
StepType step_type,
|
||||
unsigned int scan_lines,
|
||||
unsigned int scan_dummy,
|
||||
|
@ -497,11 +497,11 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
|
|||
int scan_steps,fast_steps,factor;
|
||||
unsigned int feedl,dist;
|
||||
uint32_t z1, z2;
|
||||
float yres;
|
||||
int min_speed;
|
||||
unsigned yres;
|
||||
unsigned min_speed;
|
||||
unsigned int linesel;
|
||||
|
||||
DBG(DBG_info, "%s : scan_exposure_time=%d, scan_yres=%g, step_type=%d, scan_lines=%d, "
|
||||
DBG(DBG_info, "%s : scan_exposure_time=%d, scan_yres=%d, step_type=%d, scan_lines=%d, "
|
||||
"scan_dummy=%d, feed_steps=%d, scan_mode=%d, flags=%x\n", __func__, scan_exposure_time,
|
||||
scan_yres, static_cast<unsigned>(step_type), scan_lines, scan_dummy, feed_steps,
|
||||
static_cast<unsigned>(scan_mode), flags);
|
||||
|
@ -536,7 +536,7 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
|
|||
if(scan_yres<min_speed)
|
||||
{
|
||||
yres=min_speed;
|
||||
linesel=yres/scan_yres-1;
|
||||
linesel = yres / scan_yres - 1;
|
||||
/* limit case, we need a linesel > 0 */
|
||||
if(linesel==0)
|
||||
{
|
||||
|
@ -550,7 +550,7 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
|
|||
linesel=0;
|
||||
}
|
||||
|
||||
DBG (DBG_io2, "%s: final yres=%f, linesel=%d\n", __func__, yres, linesel);
|
||||
DBG(DBG_io2, "%s: final yres=%d, linesel=%d\n", __func__, yres, linesel);
|
||||
|
||||
lincnt=scan_lines*(linesel+1);
|
||||
reg->set24(REG_LINCNT, lincnt);
|
||||
|
|
|
@ -997,7 +997,8 @@ static void gl646_set_ad_fe(Genesys_Device* dev, uint8_t set)
|
|||
* @param set action from AFE_SET, AFE_INIT and AFE_POWERSAVE
|
||||
* @param dpi resolution of the scan since it affects settings
|
||||
*/
|
||||
static void gl646_wm_hp3670(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set, int dpi)
|
||||
static void gl646_wm_hp3670(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set,
|
||||
unsigned dpi)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
int i;
|
||||
|
@ -3438,7 +3439,7 @@ bool CommandSetGl646::is_compatible_calibration(Genesys_Device* dev, const Genes
|
|||
dev->session.params.channels = dev->settings.get_channels();
|
||||
dev->current_setup.xres = dev->settings.xres;
|
||||
|
||||
DBG(DBG_io, "%s: requested=(%d,%f), tested=(%d,%f)\n", __func__,
|
||||
DBG(DBG_io, "%s: requested=(%d, %d), tested=(%d, %d)\n", __func__,
|
||||
dev->session.params.channels, dev->current_setup.xres,
|
||||
cache->params.channels, cache->used_setup.xres);
|
||||
|
||||
|
@ -3446,8 +3447,7 @@ bool CommandSetGl646::is_compatible_calibration(Genesys_Device* dev, const Genes
|
|||
* requested scan. In the case of CIS scanners, dpi isn't a criteria */
|
||||
if (!dev->model->is_cis) {
|
||||
compatible = (dev->session.params.channels == cache->params.channels) &&
|
||||
(static_cast<int>(dev->current_setup.xres) ==
|
||||
static_cast<int>(cache->used_setup.xres));
|
||||
(dev->current_setup.xres == cache->used_setup.xres);
|
||||
} else {
|
||||
compatible = dev->session.params.channels == cache->params.channels;
|
||||
}
|
||||
|
|
|
@ -1050,7 +1050,7 @@ HOME_FREE: 3
|
|||
static void gl841_init_motor_regs_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||
Genesys_Register_Set* reg,
|
||||
unsigned int scan_exposure_time,/*pixel*/
|
||||
float scan_yres,/*dpi, motor resolution*/
|
||||
unsigned scan_yres, // dpi, motor resolution
|
||||
int scan_step_type,/*0: full, 1: half, 2: quarter*/
|
||||
unsigned int scan_lines,/*lines, scan resolution*/
|
||||
unsigned int scan_dummy,
|
||||
|
@ -1059,7 +1059,7 @@ static void gl841_init_motor_regs_scan(Genesys_Device* dev, const Genesys_Sensor
|
|||
// maybe float for half/quarter step resolution?
|
||||
unsigned int flags)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "scan_exposure_time=%d, scan_yres=%g, scan_step_type=%d, scan_lines=%d,"
|
||||
DBG_HELPER_ARGS(dbg, "scan_exposure_time=%d, scan_yres=%d, scan_step_type=%d, scan_lines=%d,"
|
||||
" scan_dummy=%d, feed_steps=%d, flags=%x",
|
||||
scan_exposure_time, scan_yres, scan_step_type, scan_lines, scan_dummy,
|
||||
feed_steps, flags);
|
||||
|
|
|
@ -838,14 +838,14 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev,
|
|||
const Genesys_Sensor& sensor,
|
||||
Genesys_Register_Set* reg,
|
||||
unsigned int exposure,
|
||||
float scan_yres,
|
||||
unsigned scan_yres,
|
||||
StepType step_type,
|
||||
unsigned int scan_lines,
|
||||
unsigned int scan_dummy,
|
||||
unsigned int feed_steps,
|
||||
unsigned int flags)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "exposure=%d, scan_yres=%g, step_type=%d, scan_lines=%d, scan_dummy=%d, "
|
||||
DBG_HELPER_ARGS(dbg, "exposure=%d, scan_yres=%d, step_type=%d, scan_lines=%d, scan_dummy=%d, "
|
||||
"feed_steps=%d, flags=%x",
|
||||
exposure, scan_yres, static_cast<unsigned>(step_type), scan_lines, scan_dummy,
|
||||
feed_steps, flags);
|
||||
|
@ -1920,7 +1920,6 @@ void CommandSetGl843::slow_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
Genesys_Register_Set local_reg;
|
||||
GenesysRegister *r;
|
||||
uint8_t val;
|
||||
float resolution;
|
||||
int loop = 0;
|
||||
|
||||
if (dev->needs_home_ta) {
|
||||
|
@ -1948,7 +1947,7 @@ void CommandSetGl843::slow_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
}
|
||||
|
||||
local_reg = dev->reg;
|
||||
resolution=sanei_genesys_get_lowest_ydpi(dev);
|
||||
unsigned resolution = sanei_genesys_get_lowest_ydpi(dev);
|
||||
|
||||
const auto& sensor = sanei_genesys_find_sensor(dev, resolution, 1, dev->model->default_method);
|
||||
|
||||
|
@ -2146,13 +2145,12 @@ static void gl843_feed(Genesys_Device* dev, unsigned int steps)
|
|||
DBG_HELPER(dbg);
|
||||
Genesys_Register_Set local_reg;
|
||||
GenesysRegister *r;
|
||||
float resolution;
|
||||
uint8_t val;
|
||||
|
||||
/* prepare local registers */
|
||||
local_reg = dev->reg;
|
||||
|
||||
resolution=sanei_genesys_get_lowest_ydpi(dev);
|
||||
unsigned resolution = sanei_genesys_get_lowest_ydpi(dev);
|
||||
|
||||
const auto& sensor = sanei_genesys_find_sensor(dev, resolution, 3, dev->model->default_method);
|
||||
|
||||
|
|
|
@ -368,14 +368,14 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
|||
const Genesys_Sensor& sensor,
|
||||
Genesys_Register_Set* reg,
|
||||
unsigned int scan_exposure_time,
|
||||
float scan_yres,
|
||||
unsigned scan_yres,
|
||||
StepType step_type,
|
||||
unsigned int scan_lines,
|
||||
unsigned int scan_dummy,
|
||||
unsigned int feed_steps,
|
||||
unsigned int flags)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "scan_exposure_time=%d, scan_yres=%g, step_type=%d, scan_lines=%d, "
|
||||
DBG_HELPER_ARGS(dbg, "scan_exposure_time=%d, scan_yres=%d, step_type=%d, scan_lines=%d, "
|
||||
"scan_dummy=%d, feed_steps=%d, flags=%x",
|
||||
scan_exposure_time, scan_yres, static_cast<unsigned>(step_type), scan_lines,
|
||||
scan_dummy, feed_steps, flags);
|
||||
|
@ -1032,7 +1032,6 @@ void CommandSetGl846::slow_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
DBG_HELPER_ARGS(dbg, "wait_until_home = %d", wait_until_home);
|
||||
Genesys_Register_Set local_reg;
|
||||
GenesysRegister *r;
|
||||
float resolution;
|
||||
uint8_t val;
|
||||
int loop = 0;
|
||||
ScanColorMode scan_mode;
|
||||
|
@ -1067,7 +1066,7 @@ void CommandSetGl846::slow_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
|
||||
local_reg = dev->reg;
|
||||
|
||||
resolution=sanei_genesys_get_lowest_ydpi(dev);
|
||||
unsigned resolution = sanei_genesys_get_lowest_ydpi(dev);
|
||||
|
||||
const auto& sensor = sanei_genesys_find_sensor_any(dev);
|
||||
|
||||
|
@ -1264,13 +1263,12 @@ static void gl846_feed(Genesys_Device* dev, unsigned int steps)
|
|||
DBG_HELPER_ARGS(dbg, "steps=%d\n", steps);
|
||||
Genesys_Register_Set local_reg;
|
||||
GenesysRegister *r;
|
||||
float resolution;
|
||||
uint8_t val;
|
||||
|
||||
/* prepare local registers */
|
||||
local_reg = dev->reg;
|
||||
|
||||
resolution=sanei_genesys_get_lowest_ydpi(dev);
|
||||
unsigned resolution = sanei_genesys_get_lowest_ydpi(dev);
|
||||
const auto& sensor = sanei_genesys_find_sensor(dev, resolution, 3, dev->model->default_method);
|
||||
|
||||
ScanSession session;
|
||||
|
|
|
@ -403,14 +403,14 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
|||
const Genesys_Sensor& sensor,
|
||||
Genesys_Register_Set* reg,
|
||||
unsigned int scan_exposure_time,
|
||||
float scan_yres,
|
||||
unsigned scan_yres,
|
||||
StepType step_type,
|
||||
unsigned int scan_lines,
|
||||
unsigned int scan_dummy,
|
||||
unsigned int feed_steps,
|
||||
unsigned int flags)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "scan_exposure_time=%d, can_yres=%g, step_type=%d, scan_lines=%d, "
|
||||
DBG_HELPER_ARGS(dbg, "scan_exposure_time=%d, can_yres=%d, step_type=%d, scan_lines=%d, "
|
||||
"scan_dummy=%d, feed_steps=%d, flags=%x",
|
||||
scan_exposure_time, scan_yres, static_cast<unsigned>(step_type), scan_lines,
|
||||
scan_dummy, feed_steps, flags);
|
||||
|
@ -1075,7 +1075,6 @@ void CommandSetGl847::slow_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
DBG_HELPER_ARGS(dbg, "wait_until_home = %d", wait_until_home);
|
||||
Genesys_Register_Set local_reg;
|
||||
GenesysRegister *r;
|
||||
float resolution;
|
||||
uint8_t val;
|
||||
int loop = 0;
|
||||
ScanColorMode scan_mode;
|
||||
|
@ -1110,7 +1109,7 @@ void CommandSetGl847::slow_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
|
||||
local_reg = dev->reg;
|
||||
|
||||
resolution=sanei_genesys_get_lowest_ydpi(dev);
|
||||
unsigned resolution = sanei_genesys_get_lowest_ydpi(dev);
|
||||
|
||||
const auto& sensor = sanei_genesys_find_sensor_any(dev);
|
||||
|
||||
|
@ -1305,12 +1304,11 @@ static void gl847_feed(Genesys_Device* dev, unsigned int steps)
|
|||
DBG_HELPER_ARGS(dbg, "steps=%d", steps);
|
||||
Genesys_Register_Set local_reg;
|
||||
GenesysRegister *r;
|
||||
float resolution;
|
||||
uint8_t val;
|
||||
|
||||
local_reg = dev->reg;
|
||||
|
||||
resolution=sanei_genesys_get_lowest_ydpi(dev);
|
||||
unsigned resolution = sanei_genesys_get_lowest_ydpi(dev);
|
||||
const auto& sensor = sanei_genesys_find_sensor(dev, resolution, 3, dev->model->default_method);
|
||||
|
||||
ScanSession session;
|
||||
|
|
|
@ -2283,7 +2283,7 @@ bool sanei_genesys_is_compatible_calibration(Genesys_Device * dev, const Genesys
|
|||
/* a calibration cache is compatible if color mode and x dpi match the user
|
||||
* requested scan. In the case of CIS scanners, dpi isn't a criteria */
|
||||
if (!dev->model->is_cis) {
|
||||
compatible = (dev->settings.xres == static_cast<int>(cache->used_setup.xres));
|
||||
compatible = (dev->settings.xres == cache->used_setup.xres);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2571,7 +2571,7 @@ void debug_dump(unsigned level, const Genesys_Current_Setup& setup)
|
|||
"Pixels: %d\n"
|
||||
"Lines: %d\n"
|
||||
"exposure_time: %d\n"
|
||||
"Resolution X: %g\n"
|
||||
"Resolution X: %d\n"
|
||||
"ccd_size_divisor: %d\n"
|
||||
"stagger: %d\n"
|
||||
"max_shift: %d\n",
|
||||
|
|
|
@ -310,12 +310,12 @@ extern void sanei_genesys_write_ahb(Genesys_Device* dev, uint32_t addr, uint32_t
|
|||
extern void sanei_genesys_init_structs (Genesys_Device * dev);
|
||||
|
||||
const Genesys_Sensor& sanei_genesys_find_sensor_any(Genesys_Device* dev);
|
||||
const Genesys_Sensor& sanei_genesys_find_sensor(Genesys_Device* dev, int dpi, unsigned channels,
|
||||
ScanMethod scan_method);
|
||||
const Genesys_Sensor& sanei_genesys_find_sensor(Genesys_Device* dev, unsigned dpi,
|
||||
unsigned channels, ScanMethod scan_method);
|
||||
bool sanei_genesys_has_sensor(Genesys_Device* dev, unsigned dpi, unsigned channels,
|
||||
ScanMethod scan_method);
|
||||
Genesys_Sensor& sanei_genesys_find_sensor_for_write(Genesys_Device* dev, int dpi, unsigned channels,
|
||||
ScanMethod scan_method);
|
||||
Genesys_Sensor& sanei_genesys_find_sensor_for_write(Genesys_Device* dev, unsigned dpi,
|
||||
unsigned channels, ScanMethod scan_method);
|
||||
|
||||
std::vector<std::reference_wrapper<const Genesys_Sensor>>
|
||||
sanei_genesys_find_sensors_all(Genesys_Device* dev, ScanMethod scan_method);
|
||||
|
|
|
@ -266,7 +266,7 @@ struct Genesys_Sensor {
|
|||
|
||||
// sensor resolution in CCD pixels. Note that we may read more than one CCD pixel per logical
|
||||
// pixel, see ccd_pixels_per_system_pixel()
|
||||
int optical_res = 0;
|
||||
unsigned optical_res = 0;
|
||||
|
||||
// the resolution list that the sensor is usable at.
|
||||
ResolutionFilter resolutions = ResolutionFilter::ANY;
|
||||
|
|
|
@ -55,9 +55,9 @@ struct Genesys_Settings
|
|||
ScanColorMode scan_mode = ScanColorMode::LINEART;
|
||||
|
||||
// horizontal dpi
|
||||
int xres = 0;
|
||||
unsigned xres = 0;
|
||||
// vertical dpi
|
||||
int yres = 0;
|
||||
unsigned yres = 0;
|
||||
|
||||
//x start on scan table in mm
|
||||
double tl_x = 0;
|
||||
|
@ -317,7 +317,7 @@ struct Genesys_Current_Setup
|
|||
// used exposure time
|
||||
int exposure_time = 0;
|
||||
// used xres
|
||||
float xres = 0;
|
||||
unsigned xres = 0;
|
||||
// half ccd mode
|
||||
unsigned ccd_size_divisor = 1;
|
||||
SANE_Int stagger = 0;
|
||||
|
|
|
@ -36,7 +36,7 @@ Genesys_Calibration_Cache create_fake_calibration_entry()
|
|||
Genesys_Calibration_Cache calib;
|
||||
calib.used_setup.pixels = 10020;
|
||||
calib.used_setup.lines = 150;
|
||||
calib.used_setup.xres = 100.5;
|
||||
calib.used_setup.xres = 100;
|
||||
|
||||
calib.params.channels = 3;
|
||||
calib.params.depth = 8;
|
||||
|
|
Ładowanie…
Reference in New Issue