kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Use Sensor::optical_res directly where possible
rodzic
c1b8cb5c31
commit
21254ad929
|
@ -2945,7 +2945,6 @@ static void genesys_sheetfed_calibration(Genesys_Device* dev, Genesys_Sensor& se
|
|||
{
|
||||
DBG_HELPER(dbg);
|
||||
SANE_Bool forward = SANE_TRUE;
|
||||
int xres;
|
||||
|
||||
if (dev->cmd_set->search_strip == nullptr) {
|
||||
throw SaneException(SANE_STATUS_UNSUPPORTED, "no strip searching function available");
|
||||
|
@ -2956,7 +2955,6 @@ static void genesys_sheetfed_calibration(Genesys_Device* dev, Genesys_Sensor& se
|
|||
|
||||
/* led, offset and gain calibration are influenced by scan
|
||||
* settings. So we set it to sensor resolution */
|
||||
xres = sensor.optical_res;
|
||||
dev->settings.xres = sensor.optical_res;
|
||||
/* XP200 needs to calibrate a full and half sensor's resolution */
|
||||
if (dev->model->ccd_type == CIS_XP200
|
||||
|
@ -2985,7 +2983,7 @@ static void genesys_sheetfed_calibration(Genesys_Device* dev, Genesys_Sensor& se
|
|||
|
||||
/* since all the registers are set up correctly, just use them */
|
||||
|
||||
dev->cmd_set->coarse_gain_calibration(dev, sensor, dev->calib_reg, xres);
|
||||
dev->cmd_set->coarse_gain_calibration(dev, sensor, dev->calib_reg, sensor.optical_res);
|
||||
}
|
||||
else
|
||||
/* since we have 2 gain calibration proc, skip second if first one was
|
||||
|
@ -3066,8 +3064,8 @@ static void genesys_sheetfed_calibration(Genesys_Device* dev, Genesys_Sensor& se
|
|||
// and finally eject calibration sheet
|
||||
dev->cmd_set->eject_document(dev);
|
||||
|
||||
/* resotre settings */
|
||||
dev->settings.xres = xres;
|
||||
// restore settings
|
||||
dev->settings.xres = sensor.optical_res;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2313,7 +2313,7 @@ static void gl124_offset_calibration(Genesys_Device* dev, const Genesys_Sensor&
|
|||
DBG_HELPER(dbg);
|
||||
unsigned int channels, bpp;
|
||||
int pass = 0, avg, total_size;
|
||||
int topavg, bottomavg, resolution, lines;
|
||||
int topavg, bottomavg, lines;
|
||||
int top, bottom, black_pixels, pixels;
|
||||
|
||||
// no gain nor offset for TI AFE
|
||||
|
@ -2325,17 +2325,16 @@ static void gl124_offset_calibration(Genesys_Device* dev, const Genesys_Sensor&
|
|||
|
||||
/* offset calibration is always done in color mode */
|
||||
channels = 3;
|
||||
resolution=sensor.optical_res;
|
||||
dev->calib_pixels = sensor.sensor_pixels;
|
||||
lines=1;
|
||||
bpp=8;
|
||||
pixels= (sensor.sensor_pixels*resolution) / sensor.optical_res;
|
||||
black_pixels = (sensor.black_pixels * resolution) / sensor.optical_res;
|
||||
pixels = (sensor.sensor_pixels * sensor.optical_res) / sensor.optical_res;
|
||||
black_pixels = (sensor.black_pixels * sensor.optical_res) / sensor.optical_res;
|
||||
DBG(DBG_io2, "%s: black_pixels=%d\n", __func__, black_pixels);
|
||||
|
||||
ScanSession session;
|
||||
session.params.xres = resolution;
|
||||
session.params.yres = resolution;
|
||||
session.params.xres = sensor.optical_res;
|
||||
session.params.yres = sensor.optical_res;
|
||||
session.params.startx = 0;
|
||||
session.params.starty = 0;
|
||||
session.params.pixels = pixels;
|
||||
|
@ -2466,7 +2465,6 @@ static void gl124_coarse_gain_calibration(Genesys_Device* dev, const Genesys_Sen
|
|||
int max[3];
|
||||
float gain[3],coeff;
|
||||
int val, code, lines;
|
||||
int resolution;
|
||||
int bpp;
|
||||
|
||||
// no gain nor offset for TI AFE
|
||||
|
@ -2482,21 +2480,16 @@ static void gl124_coarse_gain_calibration(Genesys_Device* dev, const Genesys_Sen
|
|||
if(dev->settings.xres<sensor.optical_res)
|
||||
{
|
||||
coeff=0.9;
|
||||
/*resolution=sensor.optical_res/2;*/
|
||||
resolution=sensor.optical_res;
|
||||
}
|
||||
else
|
||||
{
|
||||
resolution=sensor.optical_res;
|
||||
} else {
|
||||
coeff=1.0;
|
||||
}
|
||||
lines=10;
|
||||
bpp=8;
|
||||
pixels = (sensor.sensor_pixels * resolution) / sensor.optical_res;
|
||||
pixels = (sensor.sensor_pixels * sensor.optical_res) / sensor.optical_res;
|
||||
|
||||
ScanSession session;
|
||||
session.params.xres = resolution;
|
||||
session.params.yres = resolution;
|
||||
session.params.xres = sensor.optical_res;
|
||||
session.params.yres = sensor.optical_res;
|
||||
session.params.startx = 0;
|
||||
session.params.starty = 0;
|
||||
session.params.pixels = pixels;
|
||||
|
|
|
@ -2564,7 +2564,6 @@ static SensorExposure gl843_led_calibration(Genesys_Device* dev, const Genesys_S
|
|||
DBG_HELPER(dbg);
|
||||
int num_pixels;
|
||||
int total_size;
|
||||
int used_res;
|
||||
int i, j;
|
||||
int val;
|
||||
int channels, depth;
|
||||
|
@ -2577,20 +2576,18 @@ static SensorExposure gl843_led_calibration(Genesys_Device* dev, const Genesys_S
|
|||
/* offset calibration is always done in color mode */
|
||||
channels = 3;
|
||||
depth = 16;
|
||||
used_res = sensor.optical_res;
|
||||
|
||||
// take a copy, as we're going to modify exposure
|
||||
auto calib_sensor = sanei_genesys_find_sensor(dev, used_res, channels,
|
||||
auto calib_sensor = sanei_genesys_find_sensor(dev, sensor.optical_res, channels,
|
||||
dev->settings.scan_method);
|
||||
|
||||
num_pixels =
|
||||
(calib_sensor.sensor_pixels * used_res) / calib_sensor.optical_res;
|
||||
num_pixels = (calib_sensor.sensor_pixels * calib_sensor.optical_res) / calib_sensor.optical_res;
|
||||
|
||||
/* initial calibration reg values */
|
||||
regs = dev->reg;
|
||||
|
||||
ScanSession session;
|
||||
session.params.xres = used_res;
|
||||
session.params.xres = calib_sensor.sensor_pixels;
|
||||
session.params.yres = dev->motor.base_ydpi;
|
||||
session.params.startx = 0;
|
||||
session.params.starty = 0;
|
||||
|
|
|
@ -2399,7 +2399,7 @@ static void gl846_offset_calibration(Genesys_Device* dev, const Genesys_Sensor&
|
|||
DBG_HELPER(dbg);
|
||||
unsigned int channels, bpp;
|
||||
int pass = 0, avg, total_size;
|
||||
int topavg, bottomavg, resolution, lines;
|
||||
int topavg, bottomavg, lines;
|
||||
int top, bottom, black_pixels, pixels;
|
||||
|
||||
// no gain nor offset for AKM AFE
|
||||
|
@ -2411,17 +2411,16 @@ static void gl846_offset_calibration(Genesys_Device* dev, const Genesys_Sensor&
|
|||
|
||||
/* offset calibration is always done in color mode */
|
||||
channels = 3;
|
||||
resolution=sensor.optical_res;
|
||||
dev->calib_pixels = sensor.sensor_pixels;
|
||||
lines=1;
|
||||
bpp=8;
|
||||
pixels= (sensor.sensor_pixels*resolution) / sensor.optical_res;
|
||||
black_pixels = (sensor.black_pixels * resolution) / sensor.optical_res;
|
||||
pixels = (sensor.sensor_pixels * sensor.optical_res) / sensor.optical_res;
|
||||
black_pixels = (sensor.black_pixels * sensor.optical_res) / sensor.optical_res;
|
||||
DBG(DBG_io2, "%s: black_pixels=%d\n", __func__, black_pixels);
|
||||
|
||||
ScanSession session;
|
||||
session.params.xres = resolution;
|
||||
session.params.yres = resolution;
|
||||
session.params.xres = sensor.optical_res;
|
||||
session.params.yres = sensor.optical_res;
|
||||
session.params.startx = 0;
|
||||
session.params.starty = 0;
|
||||
session.params.pixels = pixels;
|
||||
|
@ -2542,7 +2541,6 @@ static void gl846_coarse_gain_calibration(Genesys_Device* dev, const Genesys_Sen
|
|||
int max[3];
|
||||
float gain[3],coeff;
|
||||
int val, code, lines;
|
||||
int resolution;
|
||||
int bpp;
|
||||
|
||||
DBG(DBG_proc, "%s: dpi = %d\n", __func__, dpi);
|
||||
|
@ -2561,21 +2559,18 @@ static void gl846_coarse_gain_calibration(Genesys_Device* dev, const Genesys_Sen
|
|||
if(dev->settings.xres<sensor.optical_res)
|
||||
{
|
||||
coeff=0.9;
|
||||
/*resolution=sensor.optical_res/2;*/
|
||||
resolution=sensor.optical_res;
|
||||
}
|
||||
else
|
||||
{
|
||||
resolution=sensor.optical_res;
|
||||
coeff=1.0;
|
||||
}
|
||||
lines=10;
|
||||
bpp=8;
|
||||
pixels = (sensor.sensor_pixels * resolution) / sensor.optical_res;
|
||||
pixels = (sensor.sensor_pixels * sensor.optical_res) / sensor.optical_res;
|
||||
|
||||
ScanSession session;
|
||||
session.params.xres = resolution;
|
||||
session.params.yres = resolution;
|
||||
session.params.xres = sensor.optical_res;
|
||||
session.params.yres = sensor.optical_res;
|
||||
session.params.startx = 0;
|
||||
session.params.starty = 0;
|
||||
session.params.pixels = pixels;
|
||||
|
|
|
@ -1126,8 +1126,6 @@ gl847_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
int dummy = 0;
|
||||
int max_shift;
|
||||
|
||||
int optical_res;
|
||||
|
||||
DBG(DBG_info, "%s ", __func__);
|
||||
debug_dump(DBG_info, dev->settings);
|
||||
|
||||
|
@ -1153,9 +1151,6 @@ gl847_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
|
||||
gl847_compute_session(dev, session, sensor);
|
||||
|
||||
/* optical_res */
|
||||
optical_res = sensor.optical_res;
|
||||
|
||||
/* compute scan parameters values */
|
||||
/* pixels are allways given at half or full CCD optical resolution */
|
||||
/* use detected left margin and fixed value */
|
||||
|
@ -1182,7 +1177,7 @@ gl847_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
lincnt = session.params.lines + max_shift + session.num_staggered_lines;
|
||||
|
||||
dev->session = session;
|
||||
dev->current_setup.pixels = (session.optical_pixels * session.params.xres) / optical_res;
|
||||
dev->current_setup.pixels = (session.optical_pixels * session.params.xres) / sensor.optical_res;
|
||||
dev->current_setup.lines = lincnt;
|
||||
dev->current_setup.exposure_time = exposure_time;
|
||||
dev->current_setup.xres = session.params.xres;
|
||||
|
@ -2498,7 +2493,7 @@ static void gl847_offset_calibration(Genesys_Device* dev, const Genesys_Sensor&
|
|||
DBG_HELPER(dbg);
|
||||
unsigned int channels, bpp;
|
||||
int pass = 0, avg, total_size;
|
||||
int topavg, bottomavg, resolution, lines;
|
||||
int topavg, bottomavg, lines;
|
||||
int top, bottom, black_pixels, pixels;
|
||||
|
||||
// no gain nor offset for AKM AFE
|
||||
|
@ -2510,17 +2505,16 @@ static void gl847_offset_calibration(Genesys_Device* dev, const Genesys_Sensor&
|
|||
|
||||
/* offset calibration is always done in color mode */
|
||||
channels = 3;
|
||||
resolution=sensor.optical_res;
|
||||
dev->calib_pixels = sensor.sensor_pixels;
|
||||
lines=1;
|
||||
bpp=8;
|
||||
pixels= (sensor.sensor_pixels*resolution) / sensor.optical_res;
|
||||
black_pixels = (sensor.black_pixels * resolution) / sensor.optical_res;
|
||||
pixels= (sensor.sensor_pixels * sensor.optical_res) / sensor.optical_res;
|
||||
black_pixels = (sensor.black_pixels * sensor.optical_res) / sensor.optical_res;
|
||||
DBG(DBG_io2, "%s: black_pixels=%d\n", __func__, black_pixels);
|
||||
|
||||
ScanSession session;
|
||||
session.params.xres = resolution;
|
||||
session.params.yres = resolution;
|
||||
session.params.xres = sensor.optical_res;
|
||||
session.params.yres = sensor.optical_res;
|
||||
session.params.startx = 0;
|
||||
session.params.starty = 0;
|
||||
session.params.pixels = pixels;
|
||||
|
@ -2641,7 +2635,6 @@ static void gl847_coarse_gain_calibration(Genesys_Device* dev, const Genesys_Sen
|
|||
int max[3];
|
||||
float gain[3],coeff;
|
||||
int val, code, lines;
|
||||
int resolution;
|
||||
int bpp;
|
||||
|
||||
// no gain nor offset for AKM AFE
|
||||
|
@ -2658,21 +2651,18 @@ static void gl847_coarse_gain_calibration(Genesys_Device* dev, const Genesys_Sen
|
|||
if(dev->settings.xres<sensor.optical_res)
|
||||
{
|
||||
coeff=0.9;
|
||||
/*resolution=sensor.optical_res/2; */
|
||||
resolution=sensor.optical_res;
|
||||
}
|
||||
else
|
||||
{
|
||||
resolution=sensor.optical_res;
|
||||
coeff=1.0;
|
||||
}
|
||||
lines=10;
|
||||
bpp=8;
|
||||
pixels = (sensor.sensor_pixels * resolution) / sensor.optical_res;
|
||||
pixels = (sensor.sensor_pixels * sensor.optical_res) / sensor.optical_res;
|
||||
|
||||
ScanSession session;
|
||||
session.params.xres = resolution;
|
||||
session.params.yres = resolution;
|
||||
session.params.xres = sensor.optical_res;
|
||||
session.params.yres = sensor.optical_res;
|
||||
session.params.startx = 0;
|
||||
session.params.starty = 0;
|
||||
session.params.pixels = pixels;
|
||||
|
|
Ładowanie…
Reference in New Issue