kopia lustrzana https://gitlab.com/sane-project/backends
Merge branch 'genesys-handle-non-uniform-scans-at-high-level' into 'master'
genesys: handle non-uniform scans at high level See merge request sane-project/backends!152merge-requests/153/head
commit
bd35742b78
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5159,7 +5157,7 @@ probe_genesys_devices (void)
|
|||
of Genesys_Calibration_Cache as is.
|
||||
*/
|
||||
static const char* CALIBRATION_IDENT = "sane_genesys";
|
||||
static const int CALIBRATION_VERSION = 7;
|
||||
static const int CALIBRATION_VERSION = 8;
|
||||
|
||||
bool read_calibration(std::istream& str, Genesys_Device::Calibration& calibration,
|
||||
const std::string& path)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -592,7 +592,7 @@ static void gl646_setup_registers(Genesys_Device* dev,
|
|||
|
||||
/* words_per_line must be computed according to the scan's resolution */
|
||||
/* in fact, words_per_line _gives_ the actual scan resolution */
|
||||
words_per_line = (((endx - startx) * sensor.real_resolution) / sensor.optical_res);
|
||||
words_per_line = (((endx - startx) * session.output_resolution) / sensor.optical_res);
|
||||
bpp = session.params.depth/8;
|
||||
if (session.params.depth == 1) {
|
||||
words_per_line = (words_per_line+7)/8 ;
|
||||
|
@ -609,7 +609,7 @@ static void gl646_setup_registers(Genesys_Device* dev,
|
|||
DBG(DBG_info, "%s: wpl=%d\n", __func__, words_per_line);
|
||||
regs->set24(REG_MAXWD, words_per_line);
|
||||
|
||||
regs->set16(REG_DPISET, sensor.real_resolution * session.ccd_size_divisor *
|
||||
regs->set16(REG_DPISET, session.output_resolution * session.ccd_size_divisor *
|
||||
sensor.ccd_pixels_per_system_pixel());
|
||||
regs->set16(REG_LPERIOD, sensor.exposure_lperiod);
|
||||
|
||||
|
@ -790,10 +790,10 @@ static void gl646_setup_registers(Genesys_Device* dev,
|
|||
dev->read_active = SANE_TRUE;
|
||||
|
||||
dev->session = session;
|
||||
dev->current_setup.pixels = ((endx - startx) * sensor.real_resolution) / sensor.optical_res;
|
||||
dev->current_setup.pixels = ((endx - startx) * session.output_resolution) / sensor.optical_res;
|
||||
dev->current_setup.lines = linecnt;
|
||||
dev->current_setup.exposure_time = sensor.exposure_lperiod;
|
||||
dev->current_setup.xres = sensor.real_resolution;
|
||||
dev->current_setup.xres = session.output_resolution;
|
||||
dev->current_setup.ccd_size_divisor = session.ccd_size_divisor;
|
||||
dev->current_setup.stagger = session.num_staggered_lines;
|
||||
dev->current_setup.max_shift = max_shift + session.num_staggered_lines;
|
||||
|
@ -804,11 +804,10 @@ static void gl646_setup_registers(Genesys_Device* dev,
|
|||
*/
|
||||
dev->total_bytes_read = 0;
|
||||
if (session.params.depth == 1) {
|
||||
// BUG: should use settings.requested_pixels
|
||||
dev->total_bytes_to_read = ((session.params.pixels * session.params.lines) / 8 +
|
||||
(((session.params.pixels * session.params.lines) % 8) ? 1 : 0)) * session.params.channels;
|
||||
dev->total_bytes_to_read = ((session.params.requested_pixels * session.params.lines) / 8 +
|
||||
(((session.params.requested_pixels * session.params.lines) % 8) ? 1 : 0)) * session.params.channels;
|
||||
} else {
|
||||
dev->total_bytes_to_read = session.params.pixels * session.params.lines * session.params.channels * bpp;
|
||||
dev->total_bytes_to_read = session.params.requested_pixels * session.params.lines * session.params.channels * bpp;
|
||||
}
|
||||
|
||||
/* select color filter based on settings */
|
||||
|
@ -1881,6 +1880,7 @@ static void gl646_slow_back_home(Genesys_Device* dev, SANE_Bool wait_until_home)
|
|||
settings.tl_x = 0;
|
||||
settings.tl_y = 0;
|
||||
settings.pixels = 600;
|
||||
settings.requested_pixels = settings.pixels;
|
||||
settings.lines = 1;
|
||||
settings.depth = 8;
|
||||
settings.color_filter = ColorFilter::RED;
|
||||
|
@ -1973,6 +1973,7 @@ static void gl646_search_start_position(Genesys_Device* dev)
|
|||
settings.tl_x = 0;
|
||||
settings.tl_y = 0;
|
||||
settings.pixels = 600;
|
||||
settings.requested_pixels = settings.pixels;
|
||||
settings.lines = dev->model->search_lines;
|
||||
settings.depth = 8;
|
||||
settings.color_filter = ColorFilter::RED;
|
||||
|
@ -2067,6 +2068,7 @@ static void gl646_init_regs_for_shading(Genesys_Device* dev, const Genesys_Senso
|
|||
settings.tl_x = 0;
|
||||
settings.tl_y = 0;
|
||||
settings.pixels = (calib_sensor.sensor_pixels * settings.xres) / calib_sensor.optical_res;
|
||||
settings.requested_pixels = settings.pixels;
|
||||
dev->calib_lines = dev->model->shading_lines;
|
||||
settings.lines = dev->calib_lines * (3 - ccd_size_divisor);
|
||||
settings.depth = 16;
|
||||
|
@ -2216,6 +2218,7 @@ static void setup_for_scan(Genesys_Device* dev,
|
|||
session.params.startx = start;
|
||||
session.params.starty = move;
|
||||
session.params.pixels = settings.pixels;
|
||||
session.params.requested_pixels = settings.requested_pixels;
|
||||
session.params.lines = settings.lines;
|
||||
session.params.depth = depth;
|
||||
session.params.channels = settings.get_channels();
|
||||
|
@ -2329,8 +2332,8 @@ static SensorExposure gl646_led_calibration(Genesys_Device* dev, const Genesys_S
|
|||
settings.yres = resolution;
|
||||
settings.tl_x = 0;
|
||||
settings.tl_y = 0;
|
||||
settings.pixels =
|
||||
(sensor.sensor_pixels * resolution) / sensor.optical_res;
|
||||
settings.pixels = (sensor.sensor_pixels * resolution) / sensor.optical_res;
|
||||
settings.requested_pixels = settings.pixels;
|
||||
settings.lines = 1;
|
||||
settings.depth = 16;
|
||||
settings.color_filter = ColorFilter::RED;
|
||||
|
@ -2500,6 +2503,7 @@ static void ad_fe_offset_calibration(Genesys_Device* dev, const Genesys_Sensor&
|
|||
settings.tl_x = 0;
|
||||
settings.tl_y = 0;
|
||||
settings.pixels = (calib_sensor.sensor_pixels * resolution) / calib_sensor.optical_res;
|
||||
settings.requested_pixels = settings.pixels;
|
||||
settings.lines = CALIBRATION_LINES;
|
||||
settings.depth = 8;
|
||||
settings.color_filter = ColorFilter::RED;
|
||||
|
@ -2579,7 +2583,6 @@ static void gl646_offset_calibration(Genesys_Device* dev, const Genesys_Sensor&
|
|||
|
||||
unsigned int channels;
|
||||
int pass = 0, avg;
|
||||
SANE_Int resolution;
|
||||
Genesys_Settings settings;
|
||||
int topavg, bottomavg;
|
||||
int top, bottom, black_pixels;
|
||||
|
@ -2596,11 +2599,7 @@ static void gl646_offset_calibration(Genesys_Device* dev, const Genesys_Sensor&
|
|||
/* setup for a RGB scan, one full sensor's width line */
|
||||
/* resolution is the one from the final scan */
|
||||
channels = 3;
|
||||
if (dev->settings.xres > sensor.optical_res) {
|
||||
resolution = get_closest_resolution(dev->model->ccd_type, sensor.optical_res, channels);
|
||||
} else {
|
||||
resolution = get_closest_resolution(dev->model->ccd_type, dev->settings.xres, channels);
|
||||
}
|
||||
int resolution = get_closest_resolution(dev->model->ccd_type, dev->settings.xres, channels);
|
||||
|
||||
const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution, 3, ScanMethod::FLATBED);
|
||||
black_pixels = (calib_sensor.black_pixels * resolution) / calib_sensor.optical_res;
|
||||
|
@ -2614,6 +2613,7 @@ static void gl646_offset_calibration(Genesys_Device* dev, const Genesys_Sensor&
|
|||
settings.tl_x = 0;
|
||||
settings.tl_y = 0;
|
||||
settings.pixels = (calib_sensor.sensor_pixels * resolution) / calib_sensor.optical_res;
|
||||
settings.requested_pixels = settings.pixels;
|
||||
settings.lines = CALIBRATION_LINES;
|
||||
settings.depth = 8;
|
||||
settings.color_filter = ColorFilter::RED;
|
||||
|
@ -2743,6 +2743,7 @@ static void ad_fe_coarse_gain_calibration(Genesys_Device* dev, const Genesys_Sen
|
|||
settings.tl_x = 0;
|
||||
settings.tl_y = 0;
|
||||
settings.pixels = (calib_sensor.sensor_pixels * resolution) / calib_sensor.optical_res;
|
||||
settings.requested_pixels = settings.pixels;
|
||||
settings.lines = CALIBRATION_LINES;
|
||||
settings.depth = 8;
|
||||
settings.color_filter = ColorFilter::RED;
|
||||
|
@ -2856,6 +2857,7 @@ static void gl646_coarse_gain_calibration(Genesys_Device* dev, const Genesys_Sen
|
|||
settings.tl_x = SANE_UNFIX (dev->model->x_offset_ta);
|
||||
settings.pixels = (SANE_UNFIX (dev->model->x_size_ta) * resolution) / MM_PER_INCH;
|
||||
}
|
||||
settings.requested_pixels = settings.pixels;
|
||||
settings.lines = CALIBRATION_LINES;
|
||||
settings.depth = 8;
|
||||
settings.color_filter = ColorFilter::RED;
|
||||
|
@ -2998,6 +3000,7 @@ static void gl646_init_regs_for_warmup(Genesys_Device* dev, const Genesys_Sensor
|
|||
settings.tl_x = 0;
|
||||
settings.tl_y = 0;
|
||||
settings.pixels = (local_sensor.sensor_pixels * resolution) / local_sensor.optical_res;
|
||||
settings.requested_pixels = settings.pixels;
|
||||
settings.lines = 2;
|
||||
settings.depth = 8;
|
||||
settings.color_filter = ColorFilter::RED;
|
||||
|
@ -3050,6 +3053,7 @@ static void gl646_repark_head(Genesys_Device* dev)
|
|||
settings.tl_x = 0;
|
||||
settings.tl_y = 5;
|
||||
settings.pixels = 600;
|
||||
settings.requested_pixels = settings.pixels;
|
||||
settings.lines = 4;
|
||||
settings.depth = 8;
|
||||
settings.color_filter = ColorFilter::RED;
|
||||
|
@ -3452,8 +3456,8 @@ static void simple_move(Genesys_Device* dev, SANE_Int distance)
|
|||
settings.yres = resolution;
|
||||
settings.tl_y = 0;
|
||||
settings.tl_x = 0;
|
||||
settings.pixels =
|
||||
(sensor.sensor_pixels * settings.xres) / sensor.optical_res;
|
||||
settings.pixels = (sensor.sensor_pixels * settings.xres) / sensor.optical_res;
|
||||
settings.requested_pixels = settings.pixels;
|
||||
settings.lines = (distance * settings.xres) / MM_PER_INCH;
|
||||
settings.depth = 8;
|
||||
settings.color_filter = ColorFilter::RED;
|
||||
|
@ -3751,6 +3755,7 @@ static void gl646_search_strip(Genesys_Device* dev, const Genesys_Sensor& sensor
|
|||
settings.tl_y = 0;
|
||||
settings.pixels = (SANE_UNFIX (dev->model->x_size) * res) / MM_PER_INCH;
|
||||
settings.pixels /= calib_sensor.get_ccd_size_divisor_for_dpi(res);
|
||||
settings.requested_pixels = settings.pixels;
|
||||
|
||||
/* 15 mm at at time */
|
||||
settings.lines = (15 * settings.yres) / MM_PER_INCH; /* may become a parameter from genesys_devices.c */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -253,10 +253,6 @@ struct Genesys_Sensor {
|
|||
// the resolution list that the sensor is usable at.
|
||||
ResolutionFilter resolutions = ResolutionFilter::ANY;
|
||||
|
||||
// the actual resolution of the sensor. If 0, then it's equivalent to the requested resolution.
|
||||
// gl646-only.
|
||||
unsigned real_resolution = 0;
|
||||
|
||||
// the channel list that the sensor is usable at
|
||||
std::vector<unsigned> channels = { 1, 3 };
|
||||
|
||||
|
@ -334,7 +330,6 @@ struct Genesys_Sensor {
|
|||
return sensor_id == other.sensor_id &&
|
||||
optical_res == other.optical_res &&
|
||||
resolutions == other.resolutions &&
|
||||
real_resolution == other.real_resolution &&
|
||||
method == other.method &&
|
||||
ccd_size_divisor == other.ccd_size_divisor &&
|
||||
black_pixels == other.black_pixels &&
|
||||
|
@ -359,7 +354,6 @@ void serialize(Stream& str, Genesys_Sensor& x)
|
|||
serialize(str, x.sensor_id);
|
||||
serialize(str, x.optical_res);
|
||||
serialize(str, x.resolutions);
|
||||
serialize(str, x.real_resolution);
|
||||
serialize(str, x.method);
|
||||
serialize(str, x.ccd_size_divisor);
|
||||
serialize(str, x.black_pixels);
|
||||
|
|
|
@ -307,14 +307,13 @@ void genesys_init_sensor_tables()
|
|||
{
|
||||
struct CustomSensorSettings {
|
||||
ResolutionFilter resolutions;
|
||||
unsigned real_resolution;
|
||||
unsigned exposure_lperiod;
|
||||
unsigned ccd_size_divisor;
|
||||
GenesysRegisterSettingSet custom_regs;
|
||||
};
|
||||
|
||||
CustomSensorSettings custom_settings[] = {
|
||||
{ { 50 }, 50, 12000, 2, {
|
||||
{ { 50 }, 12000, 2, {
|
||||
{ 0x08, 0x00 },
|
||||
{ 0x09, 0x05 },
|
||||
{ 0x0a, 0x06 },
|
||||
|
@ -342,7 +341,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5e, 0x00 }
|
||||
}
|
||||
},
|
||||
{ { 75 }, 75, 11000, 2, {
|
||||
{ { 75 }, 11000, 2, {
|
||||
{ 0x08, 0x00 },
|
||||
{ 0x09, 0x05 },
|
||||
{ 0x0a, 0x06 },
|
||||
|
@ -370,7 +369,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5e, 0x00 }
|
||||
}
|
||||
},
|
||||
{ { 100 }, 100, 11000, 2, {
|
||||
{ { 100 }, 11000, 2, {
|
||||
{ 0x08, 0x00 },
|
||||
{ 0x09, 0x05 },
|
||||
{ 0x0a, 0x06 },
|
||||
|
@ -398,7 +397,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5e, 0x00 }
|
||||
}
|
||||
},
|
||||
{ { 150 }, 150, 11000, 2, {
|
||||
{ { 150 }, 11000, 2, {
|
||||
{ 0x08, 0x00 },
|
||||
{ 0x09, 0x05 },
|
||||
{ 0x0a, 0x06 },
|
||||
|
@ -426,7 +425,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5e, 0x00 }
|
||||
}
|
||||
},
|
||||
{ { 200 }, 200, 11000, 2, {
|
||||
{ { 200 }, 11000, 2, {
|
||||
{ 0x08, 0x00 },
|
||||
{ 0x09, 0x05 },
|
||||
{ 0x0a, 0x06 },
|
||||
|
@ -454,7 +453,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5e, 0x00 }
|
||||
}
|
||||
},
|
||||
{ { 300 }, 300, 11000, 2, {
|
||||
{ { 300 }, 11000, 2, {
|
||||
{ 0x08, 0x00 },
|
||||
{ 0x09, 0x05 },
|
||||
{ 0x0a, 0x06 },
|
||||
|
@ -482,7 +481,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5e, 0x00 }
|
||||
}
|
||||
},
|
||||
{ { 400 }, 400, 11000, 2, {
|
||||
{ { 400 }, 11000, 2, {
|
||||
{ 0x08, 0x00 },
|
||||
{ 0x09, 0x05 },
|
||||
{ 0x0a, 0x06 },
|
||||
|
@ -510,7 +509,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5e, 0x00 }
|
||||
}
|
||||
},
|
||||
{ { 600 }, 600, 11000, 2, {
|
||||
{ { 600 }, 11000, 2, {
|
||||
{ 0x08, 0x00 },
|
||||
{ 0x09, 0x05 },
|
||||
{ 0x0a, 0x06 },
|
||||
|
@ -538,35 +537,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5e, 0x00 }
|
||||
}
|
||||
},
|
||||
{ { 1200 }, 1200, 11000, 1, {
|
||||
{ 0x08, 0x0d },
|
||||
{ 0x09, 0x0f },
|
||||
{ 0x0a, 0x11 },
|
||||
{ 0x0b, 0x13 },
|
||||
{ 0x16, 0x0b },
|
||||
{ 0x17, 0x0a },
|
||||
{ 0x18, 0x30 },
|
||||
{ 0x19, 0x2a },
|
||||
{ 0x1a, 0x00 },
|
||||
{ 0x1b, 0x00 },
|
||||
{ 0x1c, 0x00 },
|
||||
{ 0x1d, 0x03 },
|
||||
{ 0x52, 0x03 },
|
||||
{ 0x53, 0x07 },
|
||||
{ 0x54, 0x0b },
|
||||
{ 0x55, 0x0f },
|
||||
{ 0x56, 0x13 },
|
||||
{ 0x57, 0x17 },
|
||||
{ 0x58, 0x23 },
|
||||
{ 0x59, 0x00 },
|
||||
{ 0x5a, 0xc1 },
|
||||
{ 0x5b, 0x00 },
|
||||
{ 0x5c, 0x00 },
|
||||
{ 0x5d, 0x00 },
|
||||
{ 0x5e, 0x00 }
|
||||
}
|
||||
},
|
||||
{ { 2400 }, 1200, 11000, 1, {
|
||||
{ { 1200 }, 11000, 1, {
|
||||
{ 0x08, 0x0d },
|
||||
{ 0x09, 0x0f },
|
||||
{ 0x0a, 0x11 },
|
||||
|
@ -599,7 +570,6 @@ void genesys_init_sensor_tables()
|
|||
for (const CustomSensorSettings& setting : custom_settings)
|
||||
{
|
||||
sensor.resolutions = setting.resolutions;
|
||||
sensor.real_resolution = setting.real_resolution;
|
||||
sensor.exposure_lperiod = setting.exposure_lperiod;
|
||||
sensor.ccd_size_divisor = setting.ccd_size_divisor;
|
||||
sensor.custom_regs = setting.custom_regs;
|
||||
|
@ -654,13 +624,12 @@ void genesys_init_sensor_tables()
|
|||
{
|
||||
struct CustomSensorSettings {
|
||||
ResolutionFilter resolutions;
|
||||
unsigned real_resolution;
|
||||
unsigned exposure_lperiod;
|
||||
GenesysRegisterSettingSet custom_regs;
|
||||
};
|
||||
|
||||
CustomSensorSettings custom_settings[] = {
|
||||
{ { 50 }, 50, 7211, {
|
||||
{ { 50 }, 7211, {
|
||||
{ 0x08, 0x14 },
|
||||
{ 0x09, 0x15 },
|
||||
{ 0x0a, 0x00 },
|
||||
|
@ -688,7 +657,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5e, 0x00 }
|
||||
}
|
||||
},
|
||||
{ { 100 }, 100, 7211, {
|
||||
{ { 100 }, 7211, {
|
||||
{ 0x08, 0x14 },
|
||||
{ 0x09, 0x15 },
|
||||
{ 0x0a, 0x00 },
|
||||
|
@ -716,7 +685,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5e, 0x00 }
|
||||
}
|
||||
},
|
||||
{ { 150 }, 150, 7211, {
|
||||
{ { 150 }, 7211, {
|
||||
{ 0x08, 0x14 },
|
||||
{ 0x09, 0x15 },
|
||||
{ 0x0a, 0x00 },
|
||||
|
@ -744,7 +713,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5e, 0x00 }
|
||||
}
|
||||
},
|
||||
{ { 300 }, 300, 8751, {
|
||||
{ { 300 }, 8751, {
|
||||
{ 0x08, 0x14 },
|
||||
{ 0x09, 0x15 },
|
||||
{ 0x0a, 0x00 },
|
||||
|
@ -772,7 +741,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5e, 0x00 }
|
||||
}
|
||||
},
|
||||
{ { 600 }, 600, 18760, {
|
||||
{ { 600 }, 18760, {
|
||||
{ 0x08, 0x0e },
|
||||
{ 0x09, 0x0f },
|
||||
{ 0x0a, 0x00 },
|
||||
|
@ -800,7 +769,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5e, 0x00 }
|
||||
}
|
||||
},
|
||||
{ { 1200 }, 1200, 21749, {
|
||||
{ { 1200 }, 21749, {
|
||||
{ 0x08, 0x02 },
|
||||
{ 0x09, 0x04 },
|
||||
{ 0x0a, 0x00 },
|
||||
|
@ -833,7 +802,6 @@ void genesys_init_sensor_tables()
|
|||
for (const CustomSensorSettings& setting : custom_settings)
|
||||
{
|
||||
sensor.resolutions = setting.resolutions;
|
||||
sensor.real_resolution = setting.real_resolution;
|
||||
sensor.exposure_lperiod = setting.exposure_lperiod;
|
||||
sensor.custom_regs = setting.custom_regs;
|
||||
s_sensors->push_back(sensor);
|
||||
|
@ -888,14 +856,13 @@ void genesys_init_sensor_tables()
|
|||
{
|
||||
struct CustomSensorSettings {
|
||||
ResolutionFilter resolutions;
|
||||
unsigned real_resolution;
|
||||
unsigned exposure_lperiod;
|
||||
unsigned ccd_size_divisor;
|
||||
GenesysRegisterSettingSet custom_regs;
|
||||
};
|
||||
|
||||
CustomSensorSettings custom_settings[] = {
|
||||
{ { 75 }, 75, 4480, 2, {
|
||||
{ { 75 }, 4480, 2, {
|
||||
{ 0x08, 0x16 },
|
||||
{ 0x09, 0x00 },
|
||||
{ 0x0a, 0x01 },
|
||||
|
@ -923,7 +890,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5e, 0x16 }
|
||||
}
|
||||
},
|
||||
{ { 150 }, 150, 4350, 2, {
|
||||
{ { 150 }, 4350, 2, {
|
||||
{ 0x08, 0x16 },
|
||||
{ 0x09, 0x00 },
|
||||
{ 0x0a, 0x01 },
|
||||
|
@ -951,7 +918,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5e, 0x16 }
|
||||
}
|
||||
},
|
||||
{ { 300 }, 300, 4350, 2, {
|
||||
{ { 300 }, 4350, 2, {
|
||||
{ 0x08, 0x16 },
|
||||
{ 0x09, 0x00 },
|
||||
{ 0x0a, 0x01 },
|
||||
|
@ -979,35 +946,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5e, 0x16 }
|
||||
}
|
||||
},
|
||||
{ { 600 }, 600, 8700, 1, {
|
||||
{ 0x08, 0x01 },
|
||||
{ 0x09, 0x03 },
|
||||
{ 0x0a, 0x04 },
|
||||
{ 0x0b, 0x06 },
|
||||
{ 0x16, 0xb7 },
|
||||
{ 0x17, 0x0a },
|
||||
{ 0x18, 0x20 },
|
||||
{ 0x19, 0x2a },
|
||||
{ 0x1a, 0x6a },
|
||||
{ 0x1b, 0x8a },
|
||||
{ 0x1c, 0x00 },
|
||||
{ 0x1d, 0x05 },
|
||||
{ 0x52, 0x0f },
|
||||
{ 0x53, 0x13 },
|
||||
{ 0x54, 0x17 },
|
||||
{ 0x55, 0x03 },
|
||||
{ 0x56, 0x07 },
|
||||
{ 0x57, 0x0b },
|
||||
{ 0x58, 0x83 },
|
||||
{ 0x59, 0x00 },
|
||||
{ 0x5a, 0xc1 },
|
||||
{ 0x5b, 0x06 },
|
||||
{ 0x5c, 0x0b },
|
||||
{ 0x5d, 0x10 },
|
||||
{ 0x5e, 0x16 }
|
||||
}
|
||||
},
|
||||
{ { 1200 }, 600, 8700, 1, {
|
||||
{ { 600 }, 8700, 1, {
|
||||
{ 0x08, 0x01 },
|
||||
{ 0x09, 0x03 },
|
||||
{ 0x0a, 0x04 },
|
||||
|
@ -1040,7 +979,6 @@ void genesys_init_sensor_tables()
|
|||
for (const CustomSensorSettings& setting : custom_settings)
|
||||
{
|
||||
sensor.resolutions = setting.resolutions;
|
||||
sensor.real_resolution = setting.real_resolution;
|
||||
sensor.exposure_lperiod = setting.exposure_lperiod;
|
||||
sensor.ccd_size_divisor = setting.ccd_size_divisor;
|
||||
sensor.custom_regs = setting.custom_regs;
|
||||
|
@ -1243,13 +1181,12 @@ void genesys_init_sensor_tables()
|
|||
{
|
||||
struct CustomSensorSettings {
|
||||
ResolutionFilter resolutions;
|
||||
unsigned real_resolution;
|
||||
unsigned exposure_lperiod;
|
||||
GenesysRegisterSettingSet custom_regs;
|
||||
};
|
||||
|
||||
CustomSensorSettings custom_settings[] = {
|
||||
{ { 75 }, 75, 4879, {
|
||||
{ { 75 }, 4879, {
|
||||
{ 0x08, 0x00 },
|
||||
{ 0x09, 0x0a },
|
||||
{ 0x0a, 0x0b },
|
||||
|
@ -1277,7 +1214,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5e, 0x00 }
|
||||
}
|
||||
},
|
||||
{ { 100 }, 100, 4487, {
|
||||
{ { 100 }, 4487, {
|
||||
{ 0x08, 0x00 },
|
||||
{ 0x09, 0x0a },
|
||||
{ 0x0a, 0x0b },
|
||||
|
@ -1305,7 +1242,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5e, 0x00 }
|
||||
}
|
||||
},
|
||||
{ { 150 }, 150, 4879, {
|
||||
{ { 150 }, 4879, {
|
||||
{ 0x08, 0x00 },
|
||||
{ 0x09, 0x0a },
|
||||
{ 0x0a, 0x0b },
|
||||
|
@ -1333,7 +1270,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5e, 0x00 }
|
||||
}
|
||||
},
|
||||
{ { 300 }, 300, 4503, {
|
||||
{ { 300 }, 4503, {
|
||||
{ 0x08, 0x00 },
|
||||
{ 0x09, 0x0a },
|
||||
{ 0x0a, 0x0b },
|
||||
|
@ -1361,7 +1298,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5e, 0x00 }
|
||||
}
|
||||
},
|
||||
{ { 600 }, 600, 10251, {
|
||||
{ { 600 }, 10251, {
|
||||
{ 0x08, 0x00 },
|
||||
{ 0x09, 0x05 },
|
||||
{ 0x0a, 0x06 },
|
||||
|
@ -1389,35 +1326,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5e, 0x00 }
|
||||
}
|
||||
},
|
||||
{ { 1200 }, 1200, 12750, {
|
||||
{ 0x08, 0x0d },
|
||||
{ 0x09, 0x0f },
|
||||
{ 0x0a, 0x11 },
|
||||
{ 0x0b, 0x13 },
|
||||
{ 0x16, 0x2b },
|
||||
{ 0x17, 0x07 },
|
||||
{ 0x18, 0x30 },
|
||||
{ 0x19, 0x2a },
|
||||
{ 0x1a, 0x00 },
|
||||
{ 0x1b, 0x00 },
|
||||
{ 0x1c, 0xc0 },
|
||||
{ 0x1d, 0x43 },
|
||||
{ 0x52, 0x03 },
|
||||
{ 0x53, 0x07 },
|
||||
{ 0x54, 0x0b },
|
||||
{ 0x55, 0x0f },
|
||||
{ 0x56, 0x13 },
|
||||
{ 0x57, 0x17 },
|
||||
{ 0x58, 0x23 },
|
||||
{ 0x59, 0x00 },
|
||||
{ 0x5a, 0xc1 },
|
||||
{ 0x5b, 0x00 },
|
||||
{ 0x5c, 0x00 },
|
||||
{ 0x5d, 0x00 },
|
||||
{ 0x5e, 0x00 }
|
||||
}
|
||||
},
|
||||
{ { 2400 }, 1200, 12750, {
|
||||
{ { 1200 }, 12750, {
|
||||
{ 0x08, 0x0d },
|
||||
{ 0x09, 0x0f },
|
||||
{ 0x0a, 0x11 },
|
||||
|
@ -1450,7 +1359,6 @@ void genesys_init_sensor_tables()
|
|||
for (const CustomSensorSettings& setting : custom_settings)
|
||||
{
|
||||
sensor.resolutions = setting.resolutions;
|
||||
sensor.real_resolution = setting.real_resolution;
|
||||
sensor.exposure_lperiod = setting.exposure_lperiod;
|
||||
sensor.custom_regs = setting.custom_regs;
|
||||
s_sensors->push_back(sensor);
|
||||
|
|
Ładowanie…
Reference in New Issue