kopia lustrzana https://gitlab.com/sane-project/backends
Merge branch 'genesys-remove-half-ccd' into 'master'
genesys: Improve code clarity by retiring half_ccd See merge request sane-project/backends!114merge-requests/115/head
commit
9085260541
|
@ -98,10 +98,10 @@ gl124_test_motor_flag_bit (SANE_Byte val)
|
|||
* profile is at a specific dpihw. Use LiDE 110 table by default.
|
||||
* @param sensor_type sensor id
|
||||
* @param dpi hardware dpi for the scan
|
||||
* @param half_ccd flag to signal half ccd mode
|
||||
* @param ccd_size_divisor flag to signal half ccd mode
|
||||
* @return a pointer to a Sensor_Profile struct
|
||||
*/
|
||||
static Sensor_Profile *get_sensor_profile(int sensor_type, int dpi, int half_ccd)
|
||||
static Sensor_Profile* get_sensor_profile(int sensor_type, int dpi, unsigned ccd_size_divisor)
|
||||
{
|
||||
unsigned int i;
|
||||
int idx;
|
||||
|
@ -111,16 +111,15 @@ static Sensor_Profile *get_sensor_profile(int sensor_type, int dpi, int half_ccd
|
|||
while(i<sizeof(sensors)/sizeof(Sensor_Profile))
|
||||
{
|
||||
/* exact match */
|
||||
if(sensors[i].sensor_type==sensor_type
|
||||
&& sensors[i].dpi==dpi
|
||||
&& sensors[i].half_ccd==half_ccd)
|
||||
if (sensors[i].sensor_type == sensor_type && sensors[i].dpi == dpi &&
|
||||
sensors[i].ccd_size_divisor == ccd_size_divisor)
|
||||
{
|
||||
return &(sensors[i]);
|
||||
}
|
||||
|
||||
/* closest match */
|
||||
if(sensors[i].sensor_type==sensor_type
|
||||
&& sensors[i].half_ccd==half_ccd)
|
||||
if (sensors[i].sensor_type == sensor_type &&
|
||||
sensors[i].ccd_size_divisor == ccd_size_divisor)
|
||||
{
|
||||
if(idx<0)
|
||||
{
|
||||
|
@ -163,16 +162,14 @@ static void gl124_homsnr_gpio(Genesys_Device* dev)
|
|||
* the actual scanning resolution. Used for fast scans.
|
||||
* @param model pointer to device model
|
||||
* @param xres required horizontal resolution
|
||||
* @return SANE_TRUE if half CCD mode enabled
|
||||
*/
|
||||
static SANE_Bool compute_half_ccd(const Genesys_Sensor& sensor, int xres)
|
||||
static unsigned compute_ccd_size_divisor(const Genesys_Sensor& sensor, int xres)
|
||||
{
|
||||
/* we have 2 domains for ccd: xres below or above half ccd max dpi */
|
||||
if (xres<=300 && sensor.ccd_size_divisor > 1)
|
||||
{
|
||||
return SANE_TRUE;
|
||||
// we have 2 domains for ccd: xres below or above half ccd max dpi
|
||||
if (xres <= 300 && sensor.ccd_size_divisor > 1) {
|
||||
return 2;
|
||||
}
|
||||
return SANE_FALSE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** @brief set all registers to default values .
|
||||
|
@ -605,12 +602,11 @@ static void gl124_set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint
|
|||
* compute the sensor exposure based on target resolution
|
||||
* @param dev pointer to device description
|
||||
* @param xres sensor's required resolution
|
||||
* @param half_ccd flag for half ccd mode
|
||||
* @param ccd_size_divisor how many CCD pixels are processed for output pixel
|
||||
*/
|
||||
static int gl124_compute_exposure(Genesys_Device *dev, int xres, int half_ccd)
|
||||
static int gl124_compute_exposure(Genesys_Device* dev, int xres, unsigned ccd_size_divisor)
|
||||
{
|
||||
Sensor_Profile* sensor_profile = get_sensor_profile(dev->model->ccd_type, xres, half_ccd);
|
||||
return sensor_profile->exposure;
|
||||
return get_sensor_profile(dev->model->ccd_type, xres, ccd_size_divisor)->exposure;
|
||||
}
|
||||
|
||||
|
||||
|
@ -820,11 +816,11 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev,
|
|||
* @param dev device to set up
|
||||
* @param regs register set to modify
|
||||
* @param dpi resolution of the sensor during scan
|
||||
* @param half_ccd flag for half ccd mode
|
||||
* @param ccd_size_divisor flag for half ccd mode
|
||||
* */
|
||||
static void gl124_setup_sensor(Genesys_Device * dev,
|
||||
const Genesys_Sensor& sensor,
|
||||
Genesys_Register_Set * regs, int dpi, int half_ccd)
|
||||
Genesys_Register_Set * regs, int dpi, unsigned ccd_size_divisor)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
int dpihw;
|
||||
|
@ -843,7 +839,8 @@ static void gl124_setup_sensor(Genesys_Device * dev,
|
|||
|
||||
// set EXPDUMMY and CKxMAP
|
||||
dpihw = sensor.get_register_hwdpi(dpi);
|
||||
Sensor_Profile* sensor_profile = get_sensor_profile(dev->model->ccd_type, dpihw, half_ccd);
|
||||
Sensor_Profile* sensor_profile = get_sensor_profile(dev->model->ccd_type, dpihw,
|
||||
ccd_size_divisor);
|
||||
|
||||
regs->set8(0x18, sensor_profile->reg18);
|
||||
regs->set8(0x20, sensor_profile->reg20);
|
||||
|
@ -903,20 +900,20 @@ static void gl124_setup_sensor(Genesys_Device * dev,
|
|||
* @param pixels logical number of pixels to use
|
||||
* @param channels number of color channels (currently 1 or 3)
|
||||
* @param depth bit depth of the scan (1, 8 or 16)
|
||||
* @param half_ccd SANE_TRUE if sensor's timings are such that x coordinates
|
||||
* must be halved
|
||||
* @param ccd_size_divisor whether sensor's timings are such that x coordinates must be halved
|
||||
* @param color_filter color channel to use as gray data
|
||||
* @param flags optical flags (@see )
|
||||
*/
|
||||
static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||
Genesys_Register_Set* reg, unsigned int exposure_time,
|
||||
int used_res, unsigned int start, unsigned int pixels,
|
||||
int channels, int depth, SANE_Bool half_ccd,
|
||||
int channels, int depth, unsigned ccd_size_divisor,
|
||||
ColorFilter color_filter, int flags)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "exposure_time=%d, used_res=%d, start=%d, pixels=%d, channels=%d, depth=%d, "
|
||||
"half_ccd=%d, flags=%x\n",
|
||||
exposure_time, used_res, start, pixels, channels, depth, half_ccd, flags);
|
||||
"ccd_size_divisor=%d, flags=%x\n",
|
||||
exposure_time, used_res, start, pixels, channels, depth, ccd_size_divisor,
|
||||
flags);
|
||||
unsigned int words_per_line, segcnt;
|
||||
unsigned int startx, endx, segnb;
|
||||
unsigned int dpiset, dpihw, factor;
|
||||
|
@ -934,8 +931,8 @@ static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
factor=sensor.optical_res/dpihw;
|
||||
DBG (DBG_io2, "%s: dpihw=%d (factor=%d)\n", __func__, dpihw, factor);
|
||||
|
||||
/* sensor parameters */
|
||||
gl124_setup_sensor(dev, sensor, reg, dpihw, half_ccd);
|
||||
// sensor parameters
|
||||
gl124_setup_sensor(dev, sensor, reg, dpihw, ccd_size_divisor);
|
||||
dpiset = used_res * ccd_pixels_per_system_pixel;
|
||||
|
||||
/* start and end coordinate in optical dpi coordinates */
|
||||
|
@ -1040,21 +1037,14 @@ static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
}
|
||||
|
||||
/* enable gamma tables */
|
||||
if (flags & OPTICAL_FLAG_DISABLE_GAMMA)
|
||||
r->value &= ~REG05_GMMENB;
|
||||
else
|
||||
r->value |= REG05_GMMENB;
|
||||
if (flags & OPTICAL_FLAG_DISABLE_GAMMA) {
|
||||
r->value &= ~REG05_GMMENB;
|
||||
} else {
|
||||
r->value |= REG05_GMMENB;
|
||||
}
|
||||
|
||||
if(half_ccd)
|
||||
{
|
||||
sanei_genesys_set_double(reg,REG_DPISET,dpiset*2);
|
||||
DBG (DBG_io2, "%s: dpiset used=%d\n", __func__, dpiset*2);
|
||||
}
|
||||
else
|
||||
{
|
||||
sanei_genesys_set_double(reg,REG_DPISET,dpiset);
|
||||
DBG (DBG_io2, "%s: dpiset used=%d\n", __func__, dpiset);
|
||||
}
|
||||
sanei_genesys_set_double(reg, REG_DPISET, dpiset * ccd_size_divisor);
|
||||
DBG (DBG_io2, "%s: dpiset used=%d\n", __func__, dpiset * ccd_size_divisor);
|
||||
|
||||
r = sanei_genesys_get_address (reg, REG06);
|
||||
r->value |= REG06_GAIN4;
|
||||
|
@ -1180,24 +1170,19 @@ static void gl124_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
int max_shift;
|
||||
size_t requested_buffer_size, read_buffer_size;
|
||||
|
||||
SANE_Bool half_ccd; /* false: full CCD res is used, true, half max CCD res is used */
|
||||
unsigned optical_res;
|
||||
|
||||
debug_dump(DBG_info, params);
|
||||
|
||||
half_ccd=compute_half_ccd(sensor, params.xres);
|
||||
unsigned ccd_size_divisor = compute_ccd_size_divisor(sensor, params.xres);
|
||||
|
||||
/* optical_res */
|
||||
optical_res = sensor.optical_res;
|
||||
if (half_ccd)
|
||||
optical_res /= 2;
|
||||
unsigned optical_res = sensor.optical_res / ccd_size_divisor;
|
||||
DBG (DBG_info, "%s: optical_res=%d\n", __func__, optical_res);
|
||||
|
||||
/* stagger */
|
||||
if ((!half_ccd) && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE))
|
||||
stagger = (4 * params.yres) / dev->motor.base_ydpi;
|
||||
else
|
||||
stagger = 0;
|
||||
if (ccd_size_divisor == 1 && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE)) {
|
||||
stagger = (4 * params.yres) / dev->motor.base_ydpi;
|
||||
} else {
|
||||
stagger = 0;
|
||||
}
|
||||
DBG (DBG_info, "gl124_init_scan_regs : stagger=%d lines\n", stagger);
|
||||
|
||||
/** @brief compute used resolution */
|
||||
|
@ -1252,7 +1237,7 @@ static void gl124_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
}
|
||||
else
|
||||
{
|
||||
exposure_time = gl124_compute_exposure (dev, used_res, half_ccd);
|
||||
exposure_time = gl124_compute_exposure(dev, used_res, ccd_size_divisor);
|
||||
scan_step_type = sanei_genesys_compute_step_type(motors, dev->model->motor_type, exposure_time);
|
||||
}
|
||||
|
||||
|
@ -1286,8 +1271,8 @@ static void gl124_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
|
||||
// now _LOGICAL_ optical values used are known, setup registers
|
||||
gl124_init_optical_regs_scan(dev, sensor, reg, exposure_time, used_res, start, used_pixels,
|
||||
params.channels, params.depth, half_ccd, params.color_filter,
|
||||
oflags);
|
||||
params.channels, params.depth, ccd_size_divisor,
|
||||
params.color_filter, oflags);
|
||||
|
||||
/*** motor parameters ***/
|
||||
|
||||
|
@ -1354,7 +1339,7 @@ static void gl124_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
dev->current_setup.exposure_time = exposure_time;
|
||||
dev->current_setup.xres = used_res;
|
||||
dev->current_setup.yres = params.yres;
|
||||
dev->current_setup.ccd_size_divisor = half_ccd ? 2 : 1;
|
||||
dev->current_setup.ccd_size_divisor = ccd_size_divisor;
|
||||
dev->current_setup.stagger = stagger;
|
||||
dev->current_setup.max_shift = max_shift + stagger;
|
||||
|
||||
|
@ -1383,7 +1368,6 @@ gl124_calculate_current_setup (Genesys_Device * dev, const Genesys_Sensor& senso
|
|||
unsigned int lincnt;
|
||||
int exposure_time;
|
||||
int stagger;
|
||||
SANE_Bool half_ccd;
|
||||
|
||||
int max_shift, dpihw;
|
||||
|
||||
|
@ -1422,7 +1406,7 @@ gl124_calculate_current_setup (Genesys_Device * dev, const Genesys_Sensor& senso
|
|||
params.color_filter = dev->settings.color_filter;
|
||||
params.flags = 0;
|
||||
|
||||
half_ccd=compute_half_ccd(sensor, params.xres);
|
||||
unsigned ccd_size_divisor = compute_ccd_size_divisor(sensor, params.xres);
|
||||
|
||||
DBG(DBG_info, "%s ", __func__);
|
||||
debug_dump(DBG_info, params);
|
||||
|
@ -1444,7 +1428,7 @@ gl124_calculate_current_setup (Genesys_Device * dev, const Genesys_Sensor& senso
|
|||
DBG (DBG_info, "%s: used_pixels=%d\n", __func__, used_pixels);
|
||||
|
||||
/* exposure */
|
||||
exposure_time = gl124_compute_exposure (dev, params.xres, half_ccd);
|
||||
exposure_time = gl124_compute_exposure(dev, params.xres, ccd_size_divisor);
|
||||
DBG (DBG_info, "%s : exposure_time=%d pixels\n", __func__, exposure_time);
|
||||
|
||||
/* max_shift */
|
||||
|
@ -1453,14 +1437,16 @@ gl124_calculate_current_setup (Genesys_Device * dev, const Genesys_Sensor& senso
|
|||
// compute hw dpi for sensor
|
||||
dpihw = sensor.get_register_hwdpi(used_res);
|
||||
|
||||
Sensor_Profile* sensor_profile = get_sensor_profile(dev->model->ccd_type, dpihw, half_ccd);
|
||||
Sensor_Profile* sensor_profile = get_sensor_profile(dev->model->ccd_type, dpihw,
|
||||
ccd_size_divisor);
|
||||
dev->segnb=sensor_profile->reg98 & 0x0f;
|
||||
|
||||
/* stagger */
|
||||
if ((!half_ccd) && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE))
|
||||
stagger = (4 * params.yres) / dev->motor.base_ydpi;
|
||||
else
|
||||
stagger = 0;
|
||||
if (ccd_size_divisor == 1 && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE)) {
|
||||
stagger = (4 * params.yres) / dev->motor.base_ydpi;
|
||||
} else {
|
||||
stagger = 0;
|
||||
}
|
||||
DBG (DBG_info, "%s: stagger=%d lines\n", __func__, stagger);
|
||||
|
||||
/* lincnt */
|
||||
|
@ -1475,7 +1461,7 @@ gl124_calculate_current_setup (Genesys_Device * dev, const Genesys_Sensor& senso
|
|||
dev->current_setup.exposure_time = exposure_time;
|
||||
dev->current_setup.xres = used_res;
|
||||
dev->current_setup.yres = params.yres;
|
||||
dev->current_setup.ccd_size_divisor = half_ccd ? 2 : 1;
|
||||
dev->current_setup.ccd_size_divisor = ccd_size_divisor;
|
||||
dev->current_setup.stagger = stagger;
|
||||
dev->current_setup.max_shift = max_shift + stagger;
|
||||
}
|
||||
|
@ -2037,12 +2023,11 @@ static void gl124_init_regs_for_shading(Genesys_Device* dev, const Genesys_Senso
|
|||
}
|
||||
resolution=dpihw;
|
||||
|
||||
/* if half CCD mode, use half resolution */
|
||||
if(compute_half_ccd(sensor, dev->settings.xres)==SANE_TRUE)
|
||||
{
|
||||
resolution /= 2;
|
||||
dev->calib_lines /= 2;
|
||||
}
|
||||
unsigned ccd_size_divisor = compute_ccd_size_divisor(sensor, dev->settings.xres);
|
||||
|
||||
resolution /= ccd_size_divisor;
|
||||
dev->calib_lines /= ccd_size_divisor; // reducing just because we reduced the resolution
|
||||
|
||||
dev->calib_resolution = resolution;
|
||||
dev->calib_total_bytes_to_read = 0;
|
||||
factor=sensor.optical_res/resolution;
|
||||
|
@ -2148,10 +2133,7 @@ static void gl124_init_regs_for_scan(Genesys_Device* dev, const Genesys_Sensor&
|
|||
/* start */
|
||||
start = SANE_UNFIX (dev->model->x_offset);
|
||||
start += dev->settings.tl_x;
|
||||
if(compute_half_ccd(sensor, dev->settings.xres)==SANE_TRUE)
|
||||
{
|
||||
start /=2;
|
||||
}
|
||||
start /= compute_ccd_size_divisor(sensor, dev->settings.xres);
|
||||
start = (start * sensor.optical_res) / MM_PER_INCH;
|
||||
|
||||
flags = 0;
|
||||
|
@ -2368,7 +2350,6 @@ static void gl124_led_calibration(Genesys_Device* dev, Genesys_Sensor& sensor,
|
|||
int turn;
|
||||
uint16_t exp[3],target;
|
||||
SANE_Bool acceptable;
|
||||
SANE_Bool half_ccd;
|
||||
|
||||
/* move to calibration area */
|
||||
move_to_calibration_area(dev, sensor, regs);
|
||||
|
@ -2377,16 +2358,12 @@ static void gl124_led_calibration(Genesys_Device* dev, Genesys_Sensor& sensor,
|
|||
channels = 3;
|
||||
depth=16;
|
||||
dpihw = sensor.get_register_hwdpi(dev->settings.xres);
|
||||
half_ccd=compute_half_ccd(sensor, dev->settings.xres);
|
||||
if(half_ccd==SANE_TRUE)
|
||||
{
|
||||
resolution = dpihw/2;
|
||||
}
|
||||
else
|
||||
{
|
||||
resolution = dpihw;
|
||||
}
|
||||
Sensor_Profile* sensor_profile = get_sensor_profile(dev->model->ccd_type, dpihw, half_ccd);
|
||||
resolution = dpihw;
|
||||
unsigned ccd_size_divisor = compute_ccd_size_divisor(sensor, dev->settings.xres);
|
||||
resolution /= ccd_size_divisor;
|
||||
|
||||
Sensor_Profile* sensor_profile = get_sensor_profile(dev->model->ccd_type, dpihw,
|
||||
ccd_size_divisor);
|
||||
num_pixels = (sensor.sensor_pixels*resolution)/sensor.optical_res;
|
||||
|
||||
/* initial calibration reg values */
|
||||
|
|
|
@ -369,10 +369,11 @@ static Memory_layout layouts[]={
|
|||
* - sensor hardware dpi
|
||||
* - half ccd mode
|
||||
*/
|
||||
typedef struct {
|
||||
struct Sensor_Profile
|
||||
{
|
||||
int sensor_type; /**> sensor id */
|
||||
int dpi; /**> maximum dpi for which data are valid */
|
||||
int half_ccd; /**> half ccd mode */
|
||||
unsigned ccd_size_divisor; // how many CCD pixels are processed per output pixel
|
||||
int exposure; /**> exposure */
|
||||
int ck1map; /**> CK1MAP */
|
||||
int ck3map; /**> CK3MAP */
|
||||
|
@ -390,7 +391,7 @@ typedef struct {
|
|||
uint8_t reg98; /**> register 0x98 value */
|
||||
uint8_t reg16; /**> register 0x16 value */
|
||||
uint8_t reg70; /**> register 0x70 value */
|
||||
} Sensor_Profile;
|
||||
};
|
||||
|
||||
static size_t order_01[]={0,1};
|
||||
static size_t order_0213[]={0,2,1,3};
|
||||
|
@ -401,28 +402,28 @@ static size_t order_0213[]={0,2,1,3};
|
|||
*/
|
||||
static Sensor_Profile sensors[]={
|
||||
/* LiDE 110 */
|
||||
{CIS_CANONLIDE110, 600, 1, 2768, 0x1e, 0x9f, 0x55, 2584, 154, 101, 388, 574, 393, NULL , 0x00, 0x0c, 0x20, 0x21, 0x00, 0x00},
|
||||
{CIS_CANONLIDE110, 600, 0, 5360, 0x1e, 0x9f, 0x55, 5168, 163, 101, 388, 574, 393, NULL , 0x00, 0x0a, 0x20, 0x21, 0x00, 0x00},
|
||||
{CIS_CANONLIDE110, 1200, 0, 10528, 0x1e, 0x9f, 0x55, 5168, 163, 101, 388, 574, 393, order_01 , 0x00, 0x08, 0x20, 0x22, 0x00, 0x00},
|
||||
{CIS_CANONLIDE110, 2400, 0, 20864, 0x1e, 0x9f, 0x55, 5168, 163, 4679, 6839, 8401, 6859, order_0213, 0x00, 0x06, 0x20, 0x24, 0x00, 0x00},
|
||||
{CIS_CANONLIDE110, 600, 2, 2768, 0x1e, 0x9f, 0x55, 2584, 154, 101, 388, 574, 393, NULL , 0x00, 0x0c, 0x20, 0x21, 0x00, 0x00},
|
||||
{CIS_CANONLIDE110, 600, 1, 5360, 0x1e, 0x9f, 0x55, 5168, 163, 101, 388, 574, 393, NULL , 0x00, 0x0a, 0x20, 0x21, 0x00, 0x00},
|
||||
{CIS_CANONLIDE110, 1200, 1, 10528, 0x1e, 0x9f, 0x55, 5168, 163, 101, 388, 574, 393, order_01 , 0x00, 0x08, 0x20, 0x22, 0x00, 0x00},
|
||||
{CIS_CANONLIDE110, 2400, 1, 20864, 0x1e, 0x9f, 0x55, 5168, 163, 4679, 6839, 8401, 6859, order_0213, 0x00, 0x06, 0x20, 0x24, 0x00, 0x00},
|
||||
|
||||
/* LiDE 120 */
|
||||
{CIS_CANONLIDE120, 600, 1, 4608, 0x0f, 0x00, 0x55, 2552, 112, 94, 894, 1044, 994, NULL , 0x00, 0x02, 0x20, 0x21, 0x15, 0x00},
|
||||
{CIS_CANONLIDE120, 600, 0, 5360, 0x0f, 0x00, 0x55, 5104, 139, 94, 1644, 1994, 1844, NULL , 0x00, 0x02, 0x20, 0x21, 0x11, 0x1f},
|
||||
{CIS_CANONLIDE120, 1200, 0, 10528, 0x0f, 0x00, 0x55,10208, 192, 94, 3194, 3794, 3594, NULL , 0x00, 0x02, 0x20, 0x21, 0x15, 0x1f},
|
||||
{CIS_CANONLIDE120, 2400, 0, 20864, 0x0f, 0x00, 0x55,20416, 298, 94, 6244, 7544, 7094, NULL , 0x00, 0x02, 0x20, 0x21, 0x11, 0x00},
|
||||
{CIS_CANONLIDE120, 600, 2, 4608, 0x0f, 0x00, 0x55, 2552, 112, 94, 894, 1044, 994, NULL , 0x00, 0x02, 0x20, 0x21, 0x15, 0x00},
|
||||
{CIS_CANONLIDE120, 600, 1, 5360, 0x0f, 0x00, 0x55, 5104, 139, 94, 1644, 1994, 1844, NULL , 0x00, 0x02, 0x20, 0x21, 0x11, 0x1f},
|
||||
{CIS_CANONLIDE120, 1200, 1, 10528, 0x0f, 0x00, 0x55,10208, 192, 94, 3194, 3794, 3594, NULL , 0x00, 0x02, 0x20, 0x21, 0x15, 0x1f},
|
||||
{CIS_CANONLIDE120, 2400, 1, 20864, 0x0f, 0x00, 0x55,20416, 298, 94, 6244, 7544, 7094, NULL , 0x00, 0x02, 0x20, 0x21, 0x11, 0x00},
|
||||
|
||||
/* LiDE 210 */
|
||||
{CIS_CANONLIDE210, 600, 1, 2768, 0x1e, 0x9f, 0x55, 2584, 154, 101, 388, 574, 393, NULL , 0x00, 0x0c, 0x20, 0x21, 0x00, 0x00},
|
||||
{CIS_CANONLIDE210, 600, 0, 5360, 0x1e, 0x9f, 0x55, 5168, 163, 101, 388, 574, 393, NULL , 0x00, 0x0a, 0x20, 0x21, 0x00, 0x00},
|
||||
{CIS_CANONLIDE210, 1200, 0, 10528, 0x1e, 0x9f, 0x55, 5168, 163, 101, 388, 574, 393, order_01 , 0x00, 0x08, 0x20, 0x22, 0x00, 0x00},
|
||||
{CIS_CANONLIDE210, 2400, 0, 20864, 0x1e, 0x9f, 0x55, 5168, 163, 4679, 6839, 8401, 6859, order_0213, 0x00, 0x06, 0x20, 0x24, 0x00, 0x00},
|
||||
{CIS_CANONLIDE210, 600, 2, 2768, 0x1e, 0x9f, 0x55, 2584, 154, 101, 388, 574, 393, NULL , 0x00, 0x0c, 0x20, 0x21, 0x00, 0x00},
|
||||
{CIS_CANONLIDE210, 600, 1, 5360, 0x1e, 0x9f, 0x55, 5168, 163, 101, 388, 574, 393, NULL , 0x00, 0x0a, 0x20, 0x21, 0x00, 0x00},
|
||||
{CIS_CANONLIDE210, 1200, 1, 10528, 0x1e, 0x9f, 0x55, 5168, 163, 101, 388, 574, 393, order_01 , 0x00, 0x08, 0x20, 0x22, 0x00, 0x00},
|
||||
{CIS_CANONLIDE210, 2400, 1, 20864, 0x1e, 0x9f, 0x55, 5168, 163, 4679, 6839, 8401, 6859, order_0213, 0x00, 0x06, 0x20, 0x24, 0x00, 0x00},
|
||||
|
||||
/* LiDE 220 */
|
||||
{CIS_CANONLIDE220, 600, 1, 2768, 0x0f, 0x9f, 0x55, 2584, 154, 101, 388, 574, 393, NULL , 0x00, 0x0c, 0x20, 0x21, 0x00, 0x00},
|
||||
{CIS_CANONLIDE220, 600, 0, 5360, 0x0f, 0x9f, 0x55, 5168, 163, 101, 388, 574, 393, NULL , 0x00, 0x0a, 0x20, 0x21, 0x00, 0x00},
|
||||
{CIS_CANONLIDE220, 1200, 0, 10528, 0x0f, 0x9f, 0x55, 5168, 163, 101, 388, 574, 393, order_01 , 0x00, 0x08, 0x20, 0x22, 0x00, 0x00},
|
||||
{CIS_CANONLIDE220, 2400, 0, 20864, 0x0f, 0x9f, 0x55, 5168, 163, 4679, 6839, 8401, 6859, order_0213, 0x00, 0x06, 0x20, 0x24, 0x00, 0x00},
|
||||
{CIS_CANONLIDE220, 600, 2, 2768, 0x0f, 0x9f, 0x55, 2584, 154, 101, 388, 574, 393, NULL , 0x00, 0x0c, 0x20, 0x21, 0x00, 0x00},
|
||||
{CIS_CANONLIDE220, 600, 1, 5360, 0x0f, 0x9f, 0x55, 5168, 163, 101, 388, 574, 393, NULL , 0x00, 0x0a, 0x20, 0x21, 0x00, 0x00},
|
||||
{CIS_CANONLIDE220, 1200, 1, 10528, 0x0f, 0x9f, 0x55, 5168, 163, 101, 388, 574, 393, order_01 , 0x00, 0x08, 0x20, 0x22, 0x00, 0x00},
|
||||
{CIS_CANONLIDE220, 2400, 1, 20864, 0x0f, 0x9f, 0x55, 5168, 163, 4679, 6839, 8401, 6859, order_0213, 0x00, 0x06, 0x20, 0x24, 0x00, 0x00},
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -288,7 +288,7 @@ get_closest_resolution(int sensor_id, int required, unsigned channels)
|
|||
* @param color true is color mode
|
||||
* @return SANE_TRUE if half ccd is used
|
||||
*/
|
||||
static SANE_Bool is_half_ccd(int sensor_id, int required, unsigned channels)
|
||||
static unsigned get_ccd_size_divisor(int sensor_id, int required, unsigned channels)
|
||||
{
|
||||
int i, nb;
|
||||
|
||||
|
@ -301,14 +301,14 @@ static SANE_Bool is_half_ccd(int sensor_id, int required, unsigned channels)
|
|||
&& sensor_master[i].dpi == required
|
||||
&& sensor_master[i].channels == channels)
|
||||
{
|
||||
DBG(DBG_io, "%s: match found for %d (half_ccd=%d)\n", __func__, required,
|
||||
sensor_master[i].half_ccd);
|
||||
return sensor_master[i].half_ccd;
|
||||
DBG(DBG_io, "%s: match found for %d (ccd_size_divisor=%d)\n", __func__, required,
|
||||
sensor_master[i].ccd_size_divisor);
|
||||
return sensor_master[i].ccd_size_divisor;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
DBG(DBG_info, "%s: failed to find match for %d dpi\n", __func__, required);
|
||||
return SANE_FALSE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -410,7 +410,6 @@ static void gl646_setup_registers(Genesys_Device* dev,
|
|||
int stagger, words_per_line, max_shift;
|
||||
size_t requested_buffer_size;
|
||||
size_t read_buffer_size;
|
||||
SANE_Bool half_ccd = SANE_FALSE;
|
||||
SANE_Int xresolution;
|
||||
int feedl;
|
||||
|
||||
|
@ -484,8 +483,7 @@ static void gl646_setup_registers(Genesys_Device* dev,
|
|||
sensor_mst->sensor, sensor_mst->cksel);
|
||||
}
|
||||
|
||||
/* half_ccd if manual clock programming or dpi is half dpiset */
|
||||
half_ccd = sensor_mst->half_ccd;
|
||||
unsigned ccd_size_divisor = sensor_mst->ccd_size_divisor;
|
||||
|
||||
/* now apply values from settings to registers */
|
||||
if (sensor_mst->regs_0x10_0x15 != NULL)
|
||||
|
@ -508,10 +506,11 @@ static void gl646_setup_registers(Genesys_Device* dev,
|
|||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
r = sanei_genesys_get_address (regs, 0x08 + i);
|
||||
if (half_ccd == SANE_TRUE)
|
||||
r->value = settings->manual_0x08_0x0b[i];
|
||||
else
|
||||
r->value = settings->regs_0x08_0x0b[i];
|
||||
if (ccd_size_divisor > 1) {
|
||||
r->value = settings->manual_0x08_0x0b[i];
|
||||
} else {
|
||||
r->value = settings->regs_0x08_0x0b[i];
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
|
@ -525,8 +524,7 @@ static void gl646_setup_registers(Genesys_Device* dev,
|
|||
r = sanei_genesys_get_address (regs, 0x52 + i);
|
||||
r->value = settings->regs_0x52_0x5e[i];
|
||||
}
|
||||
if (half_ccd == SANE_TRUE)
|
||||
{
|
||||
if (ccd_size_divisor > 1) {
|
||||
for (i = 0; i < 7; i++)
|
||||
{
|
||||
r = sanei_genesys_get_address (regs, 0x52 + i);
|
||||
|
@ -672,10 +670,10 @@ static void gl646_setup_registers(Genesys_Device* dev,
|
|||
regs->find_reg(0x05).value &= ~REG05_LEDADD;
|
||||
}
|
||||
|
||||
/* cktoggle, ckdelay and cksel at once, cktdelay=2 => half_ccd for md5345 */
|
||||
/* cktoggle, ckdelay and cksel at once, cktdelay=2 => ccd_size_divisor == 2 for md5345 */
|
||||
regs->find_reg(0x18).value = sensor_mst->r18;
|
||||
|
||||
/* manual CCD/2 clock programming => half_ccd for hp2300 */
|
||||
/* manual CCD/2 clock programming on ccd_size_divisor == 2 for hp2300 */
|
||||
regs->find_reg(0x1d).value = sensor_mst->r1d;
|
||||
|
||||
/* HP2400 1200dpi mode tuning */
|
||||
|
@ -713,8 +711,7 @@ static void gl646_setup_registers(Genesys_Device* dev,
|
|||
|
||||
/* at QUATER_STEP lines are 'staggered' and need correction */
|
||||
stagger = 0;
|
||||
if ((!half_ccd) && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE))
|
||||
{
|
||||
if (ccd_size_divisor == 1 && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE)) {
|
||||
/* for HP3670, stagger happens only at >=1200 dpi */
|
||||
if ((dev->model->motor_type != MOTOR_HP3670 && dev->model->motor_type != MOTOR_HP2400)
|
||||
|| params.yres >= (unsigned) sensor.optical_res)
|
||||
|
@ -740,16 +737,11 @@ static void gl646_setup_registers(Genesys_Device* dev,
|
|||
}
|
||||
|
||||
/* scanner's x coordinates are expressed in physical DPI but they must be divided by cksel */
|
||||
sx = startx / sensor_mst->cksel;
|
||||
ex = endx / sensor_mst->cksel;
|
||||
if (half_ccd == SANE_TRUE)
|
||||
{
|
||||
sx /= 2;
|
||||
ex /= 2;
|
||||
}
|
||||
sx = startx / sensor_mst->cksel / ccd_size_divisor;
|
||||
ex = endx / sensor_mst->cksel / ccd_size_divisor;
|
||||
sanei_genesys_set_double(regs, REG_STRPIXEL, sx);
|
||||
sanei_genesys_set_double(regs, REG_ENDPIXEL, ex);
|
||||
DBG(DBG_info, "%s: startx=%d, endx=%d, half_ccd=%d\n", __func__, sx, ex, half_ccd);
|
||||
DBG(DBG_info, "%s: startx=%d, endx=%d, ccd_size_divisor=%d\n", __func__, sx, ex, ccd_size_divisor);
|
||||
|
||||
/* words_per_line must be computed according to the scan's resolution */
|
||||
/* in fact, words_per_line _gives_ the actual scan resolution */
|
||||
|
@ -960,7 +952,7 @@ static void gl646_setup_registers(Genesys_Device* dev,
|
|||
dev->current_setup.exposure_time = sensor_mst->exposure;
|
||||
dev->current_setup.xres = sensor_mst->xdpi;
|
||||
dev->current_setup.yres = motor->ydpi;
|
||||
dev->current_setup.ccd_size_divisor = half_ccd ? 2 : 1;
|
||||
dev->current_setup.ccd_size_divisor = ccd_size_divisor;
|
||||
dev->current_setup.stagger = stagger;
|
||||
dev->current_setup.max_shift = max_shift + stagger;
|
||||
|
||||
|
@ -1000,7 +992,7 @@ static void gl646_setup_registers(Genesys_Device* dev,
|
|||
/* *dev : device infos
|
||||
*regs : regiters to be set
|
||||
extended : do extended set up
|
||||
half_ccd: set up for half ccd resolution
|
||||
ccd_size_divisor: set up for half ccd resolution
|
||||
all registers 08-0B, 10-1D, 52-5E are set up. They shouldn't
|
||||
appear anywhere else but in register init
|
||||
*/
|
||||
|
@ -2211,7 +2203,7 @@ static void gl646_init_regs_for_coarse_calibration(Genesys_Device* dev,
|
|||
* init registers for shading calibration
|
||||
* we assume that scanner's head is on an area suiting shading calibration.
|
||||
* We scan a full scan width area by the shading line number for the device
|
||||
* at either at full sensor's resolution or half depending upon half_ccd
|
||||
* at either at full sensor's resolution or half depending upon ccd_size_divisor
|
||||
* @param dev scanner's device
|
||||
*/
|
||||
static void gl646_init_regs_for_shading(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||
|
@ -2220,20 +2212,15 @@ static void gl646_init_regs_for_shading(Genesys_Device* dev, const Genesys_Senso
|
|||
DBG_HELPER(dbg);
|
||||
(void) regs;
|
||||
Genesys_Settings settings;
|
||||
/* 1: no half_ccd, 2: use half number of pixels */
|
||||
int half_ccd = 1;
|
||||
int cksel = 1;
|
||||
|
||||
/* fill settings for scan : always a color scan */
|
||||
int channels = 3;
|
||||
|
||||
if (sensor.ccd_size_divisor > 1)
|
||||
{
|
||||
// when shading all (full width) line, we must adapt to half_ccd case
|
||||
if (is_half_ccd(dev->model->ccd_type, dev->settings.xres, channels) == SANE_TRUE)
|
||||
{
|
||||
half_ccd = 2;
|
||||
}
|
||||
unsigned ccd_size_divisor = 1;
|
||||
if (sensor.ccd_size_divisor > 1) {
|
||||
// when shading all (full width) line, we must adapt to ccd_size_divisor != 1 case
|
||||
ccd_size_divisor = get_ccd_size_divisor(dev->model->ccd_type, dev->settings.xres, channels);
|
||||
}
|
||||
|
||||
settings.scan_method = dev->settings.scan_method;
|
||||
|
@ -2243,7 +2230,7 @@ static void gl646_init_regs_for_shading(Genesys_Device* dev, const Genesys_Senso
|
|||
// FIXME: always a color scan, but why don't we set scan_mode to COLOR_SINGLE_PASS always?
|
||||
settings.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||
}
|
||||
settings.xres = sensor.optical_res / half_ccd;
|
||||
settings.xres = sensor.optical_res / ccd_size_divisor;
|
||||
cksel = get_cksel(dev->model->ccd_type, dev->settings.xres, channels);
|
||||
settings.xres = settings.xres / cksel;
|
||||
settings.yres = settings.xres;
|
||||
|
@ -2252,7 +2239,7 @@ static void gl646_init_regs_for_shading(Genesys_Device* dev, const Genesys_Senso
|
|||
settings.pixels =
|
||||
(sensor.sensor_pixels * settings.xres) / sensor.optical_res;
|
||||
dev->calib_lines = dev->model->shading_lines;
|
||||
settings.lines = dev->calib_lines * (3 - half_ccd);
|
||||
settings.lines = dev->calib_lines * (3 - ccd_size_divisor);
|
||||
settings.depth = 16;
|
||||
settings.color_filter = dev->settings.color_filter;
|
||||
|
||||
|
@ -3946,21 +3933,15 @@ static void gl646_search_strip(Genesys_Device* dev, const Genesys_Sensor& sensor
|
|||
SANE_Bool black)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
SANE_Bool half_ccd = SANE_FALSE;
|
||||
Genesys_Settings settings;
|
||||
int res = get_closest_resolution(dev->model->ccd_type, 75, 1);
|
||||
unsigned int pass, count, found, x, y;
|
||||
char title[80];
|
||||
|
||||
/* adapt to half_ccd case */
|
||||
if (sensor.ccd_size_divisor > 1)
|
||||
{
|
||||
/* walk the master mode list to find if half_ccd */
|
||||
// FIXME: possibly wrong channel count for is_half_ccd
|
||||
if (is_half_ccd (dev->model->ccd_type, res, 3) == SANE_TRUE)
|
||||
{
|
||||
half_ccd = SANE_TRUE;
|
||||
}
|
||||
unsigned ccd_size_divisor = 1;
|
||||
if (sensor.ccd_size_divisor > 1) {
|
||||
// FIXME: possibly wrong channel count for ccd_size_divisor
|
||||
ccd_size_divisor = get_ccd_size_divisor(dev->model->ccd_type, res, 3);
|
||||
}
|
||||
|
||||
/* we set up for a lowest available resolution color grey scan, full width */
|
||||
|
@ -3971,10 +3952,7 @@ static void gl646_search_strip(Genesys_Device* dev, const Genesys_Sensor& sensor
|
|||
settings.tl_x = 0;
|
||||
settings.tl_y = 0;
|
||||
settings.pixels = (SANE_UNFIX (dev->model->x_size) * res) / MM_PER_INCH;
|
||||
if (half_ccd == SANE_TRUE)
|
||||
{
|
||||
settings.pixels /= 2;
|
||||
}
|
||||
settings.pixels /= ccd_size_divisor;
|
||||
|
||||
/* 15 mm at at time */
|
||||
settings.lines = (15 * settings.yres) / MM_PER_INCH; /* may become a parameter from genesys_devices.c */
|
||||
|
|
|
@ -288,7 +288,7 @@ typedef struct
|
|||
/**
|
||||
* master sensor settings table entry
|
||||
*/
|
||||
typedef struct
|
||||
struct Sensor_Master
|
||||
{
|
||||
/* key */
|
||||
SANE_Int sensor; /**< sensor identifier */
|
||||
|
@ -303,10 +303,14 @@ typedef struct
|
|||
SANE_Int dummy; /**< dummy exposure time */
|
||||
/* uint8_t regs_0x10_0x15[6];*/
|
||||
uint8_t *regs_0x10_0x15; /**< per color exposure time for CIS scanners */
|
||||
SANE_Bool half_ccd; /**> true if manual CCD/2 clock programming or real dpi is half dpiset */
|
||||
|
||||
// selects manual CCD/2 clock programming. I.e. we're scanning at high DPI, but clock is setup
|
||||
// such that we acquire only every 2nd pixel data
|
||||
unsigned ccd_size_divisor;
|
||||
|
||||
uint8_t r18; /**> content of register 18h */
|
||||
uint8_t r1d; /**> content of register 1dh */
|
||||
} Sensor_Master;
|
||||
};
|
||||
|
||||
/**
|
||||
* settings for a given resolution and DPISET
|
||||
|
@ -335,85 +339,85 @@ static uint8_t xp200_gray[6]={0x05, 0x0a, 0x0f, 0xa0, 0x10, 0x10};
|
|||
*/
|
||||
static Sensor_Master sensor_master[] = {
|
||||
/* HP3670 master settings */
|
||||
{CCD_HP3670, 75, 3, 75, 4879, 300, 4, 42, NULL, SANE_FALSE, 0x33, 0x43},
|
||||
{CCD_HP3670, 100, 3, 100, 4487, 400, 4, 42, NULL, SANE_FALSE, 0x33, 0x43},
|
||||
{CCD_HP3670, 150, 3, 150, 4879, 600, 4, 42, NULL, SANE_FALSE, 0x33, 0x43},
|
||||
{CCD_HP3670, 300, 3, 300, 4503, 1200, 4, 42, NULL, SANE_FALSE, 0x33, 0x43},
|
||||
{CCD_HP3670, 600, 3, 600, 10251, 1200, 2, 42, NULL, SANE_FALSE, 0x31, 0x43},
|
||||
{CCD_HP3670,1200, 3, 1200, 12750, 1200, 1, 42, NULL, SANE_FALSE, 0x30, 0x43},
|
||||
{CCD_HP3670,2400, 3, 1200, 12750, 1200, 1, 42, NULL, SANE_FALSE, 0x30, 0x43},
|
||||
{CCD_HP3670, 75, 1, 75, 4879, 300, 4, 42, NULL, SANE_FALSE, 0x33, 0x43},
|
||||
{CCD_HP3670, 100, 1, 100, 4487, 400, 4, 42, NULL, SANE_FALSE, 0x33, 0x43},
|
||||
{CCD_HP3670, 150, 1, 150, 4879, 600, 4, 42, NULL, SANE_FALSE, 0x33, 0x43},
|
||||
{CCD_HP3670, 300, 1, 300, 4503, 1200, 4, 42, NULL, SANE_FALSE, 0x33, 0x43},
|
||||
{CCD_HP3670, 600, 1, 600, 10251, 1200, 2, 42, NULL, SANE_FALSE, 0x31, 0x43},
|
||||
{CCD_HP3670,1200, 1, 1200, 12750, 1200, 1, 42, NULL, SANE_FALSE, 0x30, 0x43},
|
||||
{CCD_HP3670,2400, 1, 1200, 12750, 1200, 1, 42, NULL, SANE_FALSE, 0x30, 0x43},
|
||||
{CCD_HP3670, 75, 3, 75, 4879, 300, 4, 42, NULL, 1, 0x33, 0x43},
|
||||
{CCD_HP3670, 100, 3, 100, 4487, 400, 4, 42, NULL, 1, 0x33, 0x43},
|
||||
{CCD_HP3670, 150, 3, 150, 4879, 600, 4, 42, NULL, 1, 0x33, 0x43},
|
||||
{CCD_HP3670, 300, 3, 300, 4503, 1200, 4, 42, NULL, 1, 0x33, 0x43},
|
||||
{CCD_HP3670, 600, 3, 600, 10251, 1200, 2, 42, NULL, 1, 0x31, 0x43},
|
||||
{CCD_HP3670,1200, 3, 1200, 12750, 1200, 1, 42, NULL, 1, 0x30, 0x43},
|
||||
{CCD_HP3670,2400, 3, 1200, 12750, 1200, 1, 42, NULL, 1, 0x30, 0x43},
|
||||
{CCD_HP3670, 75, 1, 75, 4879, 300, 4, 42, NULL, 1, 0x33, 0x43},
|
||||
{CCD_HP3670, 100, 1, 100, 4487, 400, 4, 42, NULL, 1, 0x33, 0x43},
|
||||
{CCD_HP3670, 150, 1, 150, 4879, 600, 4, 42, NULL, 1, 0x33, 0x43},
|
||||
{CCD_HP3670, 300, 1, 300, 4503, 1200, 4, 42, NULL, 1, 0x33, 0x43},
|
||||
{CCD_HP3670, 600, 1, 600, 10251, 1200, 2, 42, NULL, 1, 0x31, 0x43},
|
||||
{CCD_HP3670,1200, 1, 1200, 12750, 1200, 1, 42, NULL, 1, 0x30, 0x43},
|
||||
{CCD_HP3670,2400, 1, 1200, 12750, 1200, 1, 42, NULL, 1, 0x30, 0x43},
|
||||
|
||||
/* HP 2400 master settings */
|
||||
{CCD_HP2400, 50, 3, 50, 7211, 200, 4, 42, NULL, SANE_FALSE, 0x3f, 0x02},
|
||||
{CCD_HP2400, 100, 3, 100, 7211, 400, 4, 42, NULL, SANE_FALSE, 0x3f, 0x02},
|
||||
{CCD_HP2400, 150, 3, 150, 7211, 600, 4, 42, NULL, SANE_FALSE, 0x3f, 0x02},
|
||||
{CCD_HP2400, 300, 3, 300, 8751, 1200, 4, 42, NULL, SANE_FALSE, 0x3f, 0x02},
|
||||
{CCD_HP2400, 600, 3, 600, 18760, 1200, 2, 42, NULL, SANE_FALSE, 0x31, 0x02},
|
||||
{CCD_HP2400,1200, 3, 1200, 21749, 1200, 1, 42, NULL, SANE_FALSE, 0x30, 0x42},
|
||||
{CCD_HP2400, 50, 1, 50, 7211, 200, 4, 42, NULL, SANE_FALSE, 0x3f, 0x02},
|
||||
{CCD_HP2400, 100, 1, 100, 7211, 400, 4, 42, NULL, SANE_FALSE, 0x3f, 0x02},
|
||||
{CCD_HP2400, 150, 1, 150, 7211, 600, 4, 42, NULL, SANE_FALSE, 0x3f, 0x02},
|
||||
{CCD_HP2400, 300, 1, 300, 8751, 1200, 4, 42, NULL, SANE_FALSE, 0x3f, 0x02},
|
||||
{CCD_HP2400, 600, 1, 600, 18760, 1200, 2, 42, NULL, SANE_FALSE, 0x31, 0x02},
|
||||
{CCD_HP2400,1200, 1, 1200, 21749, 1200, 1, 42, NULL, SANE_FALSE, 0x30, 0x42},
|
||||
{CCD_HP2400, 50, 3, 50, 7211, 200, 4, 42, NULL, 1, 0x3f, 0x02},
|
||||
{CCD_HP2400, 100, 3, 100, 7211, 400, 4, 42, NULL, 1, 0x3f, 0x02},
|
||||
{CCD_HP2400, 150, 3, 150, 7211, 600, 4, 42, NULL, 1, 0x3f, 0x02},
|
||||
{CCD_HP2400, 300, 3, 300, 8751, 1200, 4, 42, NULL, 1, 0x3f, 0x02},
|
||||
{CCD_HP2400, 600, 3, 600, 18760, 1200, 2, 42, NULL, 1, 0x31, 0x02},
|
||||
{CCD_HP2400,1200, 3, 1200, 21749, 1200, 1, 42, NULL, 1, 0x30, 0x42},
|
||||
{CCD_HP2400, 50, 1, 50, 7211, 200, 4, 42, NULL, 1, 0x3f, 0x02},
|
||||
{CCD_HP2400, 100, 1, 100, 7211, 400, 4, 42, NULL, 1, 0x3f, 0x02},
|
||||
{CCD_HP2400, 150, 1, 150, 7211, 600, 4, 42, NULL, 1, 0x3f, 0x02},
|
||||
{CCD_HP2400, 300, 1, 300, 8751, 1200, 4, 42, NULL, 1, 0x3f, 0x02},
|
||||
{CCD_HP2400, 600, 1, 600, 18760, 1200, 2, 42, NULL, 1, 0x31, 0x02},
|
||||
{CCD_HP2400,1200, 1, 1200, 21749, 1200, 1, 42, NULL, 1, 0x30, 0x42},
|
||||
|
||||
/* XP 200 master settings */
|
||||
{CIS_XP200 , 75, 3, 75, 5700, 75, 1, 42, xp200_color, SANE_FALSE, 0x00, 0x11},
|
||||
{CIS_XP200 , 100, 3, 100, 5700, 100, 1, 42, xp200_color, SANE_FALSE, 0x00, 0x11},
|
||||
{CIS_XP200 , 200, 3, 200, 5700, 200, 1, 42, xp200_color, SANE_FALSE, 0x00, 0x11},
|
||||
{CIS_XP200 , 300, 3, 300, 9000, 300, 1, 42, xp200_color, SANE_FALSE, 0x00, 0x11},
|
||||
{CIS_XP200 , 600, 3, 600, 16000, 600, 1, 42, xp200_color, SANE_FALSE, 0x00, 0x11},
|
||||
{CIS_XP200 , 75, 3, 75, 5700, 75, 1, 42, xp200_color, 1, 0x00, 0x11},
|
||||
{CIS_XP200 , 100, 3, 100, 5700, 100, 1, 42, xp200_color, 1, 0x00, 0x11},
|
||||
{CIS_XP200 , 200, 3, 200, 5700, 200, 1, 42, xp200_color, 1, 0x00, 0x11},
|
||||
{CIS_XP200 , 300, 3, 300, 9000, 300, 1, 42, xp200_color, 1, 0x00, 0x11},
|
||||
{CIS_XP200 , 600, 3, 600, 16000, 600, 1, 42, xp200_color, 1, 0x00, 0x11},
|
||||
|
||||
{CIS_XP200 , 75, 1, 75, 16000, 75, 1, 42, xp200_gray, SANE_FALSE, 0x00, 0x11},
|
||||
{CIS_XP200 , 100, 1, 100, 7800, 100, 1, 42, xp200_gray, SANE_FALSE, 0x00, 0x11},
|
||||
{CIS_XP200 , 200, 1, 200, 11000, 200, 1, 42, xp200_gray, SANE_FALSE, 0x00, 0x11},
|
||||
{CIS_XP200 , 300, 1, 300, 13000, 300, 1, 42, xp200_gray, SANE_FALSE, 0x00, 0x11},
|
||||
{CIS_XP200 , 600, 1, 600, 24000, 600, 1, 42, xp200_gray, SANE_FALSE, 0x00, 0x11},
|
||||
{CIS_XP200 , 75, 1, 75, 16000, 75, 1, 42, xp200_gray, 1, 0x00, 0x11},
|
||||
{CIS_XP200 , 100, 1, 100, 7800, 100, 1, 42, xp200_gray, 1, 0x00, 0x11},
|
||||
{CIS_XP200 , 200, 1, 200, 11000, 200, 1, 42, xp200_gray, 1, 0x00, 0x11},
|
||||
{CIS_XP200 , 300, 1, 300, 13000, 300, 1, 42, xp200_gray, 1, 0x00, 0x11},
|
||||
{CIS_XP200 , 600, 1, 600, 24000, 600, 1, 42, xp200_gray, 1, 0x00, 0x11},
|
||||
|
||||
/* HP 2300 master settings */
|
||||
{CCD_HP2300, 75, 3, 75, 4480, 150, 1, 42, NULL, SANE_TRUE , 0x20, 0x85},
|
||||
{CCD_HP2300, 150, 3, 150, 4350, 300, 1, 42, NULL, SANE_TRUE , 0x20, 0x85},
|
||||
{CCD_HP2300, 300, 3, 300, 4350, 600, 1, 42, NULL, SANE_TRUE , 0x20, 0x85},
|
||||
{CCD_HP2300, 600, 3, 600, 8700, 600, 1, 42, NULL, SANE_FALSE, 0x20, 0x05},
|
||||
{CCD_HP2300,1200, 3, 600, 8700, 600, 1, 42, NULL, SANE_FALSE, 0x20, 0x05},
|
||||
{CCD_HP2300, 75, 1, 75, 4480, 150, 1, 42, NULL, SANE_TRUE , 0x20, 0x85},
|
||||
{CCD_HP2300, 150, 1, 150, 4350, 300, 1, 42, NULL, SANE_TRUE , 0x20, 0x85},
|
||||
{CCD_HP2300, 300, 1, 300, 4350, 600, 1, 42, NULL, SANE_TRUE , 0x20, 0x85},
|
||||
{CCD_HP2300, 600, 1, 600, 8700, 600, 1, 42, NULL, SANE_FALSE, 0x20, 0x05},
|
||||
{CCD_HP2300,1200, 1, 600, 8700, 600, 1, 42, NULL, SANE_FALSE, 0x20, 0x05},
|
||||
{CCD_HP2300, 75, 3, 75, 4480, 150, 1, 42, NULL, 2, 0x20, 0x85},
|
||||
{CCD_HP2300, 150, 3, 150, 4350, 300, 1, 42, NULL, 2, 0x20, 0x85},
|
||||
{CCD_HP2300, 300, 3, 300, 4350, 600, 1, 42, NULL, 2, 0x20, 0x85},
|
||||
{CCD_HP2300, 600, 3, 600, 8700, 600, 1, 42, NULL, 1, 0x20, 0x05},
|
||||
{CCD_HP2300,1200, 3, 600, 8700, 600, 1, 42, NULL, 1, 0x20, 0x05},
|
||||
{CCD_HP2300, 75, 1, 75, 4480, 150, 1, 42, NULL, 2, 0x20, 0x85},
|
||||
{CCD_HP2300, 150, 1, 150, 4350, 300, 1, 42, NULL, 2, 0x20, 0x85},
|
||||
{CCD_HP2300, 300, 1, 300, 4350, 600, 1, 42, NULL, 2, 0x20, 0x85},
|
||||
{CCD_HP2300, 600, 1, 600, 8700, 600, 1, 42, NULL, 1, 0x20, 0x05},
|
||||
{CCD_HP2300,1200, 1, 600, 8700, 600, 1, 42, NULL, 1, 0x20, 0x05},
|
||||
/* non half ccd 300 dpi settings
|
||||
{CCD_HP2300, 300, 3, 300, 8700, 300, 1, 42, NULL, SANE_FALSE, 0x20, 0x05},
|
||||
{CCD_HP2300, 300, 1, 300, 8700, 300, 1, 42, NULL, SANE_FALSE, 0x20, 0x05},
|
||||
{CCD_HP2300, 300, 3, 300, 8700, 300, 1, 42, NULL, 1, 0x20, 0x05},
|
||||
{CCD_HP2300, 300, 1, 300, 8700, 300, 1, 42, NULL, 1, 0x20, 0x05},
|
||||
*/
|
||||
|
||||
/* MD5345/6471 master settings */
|
||||
{CCD_5345 , 50, 3, 50, 12000, 100, 1, 42, NULL, SANE_TRUE , 0x28, 0x03},
|
||||
{CCD_5345 , 75, 3, 75, 11000, 150, 1, 42, NULL, SANE_TRUE , 0x28, 0x03},
|
||||
{CCD_5345 , 100, 3, 100, 11000, 200, 1, 42, NULL, SANE_TRUE , 0x28, 0x03},
|
||||
{CCD_5345 , 150, 3, 150, 11000, 300, 1, 42, NULL, SANE_TRUE , 0x28, 0x03},
|
||||
{CCD_5345 , 200, 3, 200, 11000, 400, 1, 42, NULL, SANE_TRUE , 0x28, 0x03},
|
||||
{CCD_5345 , 300, 3, 300, 11000, 600, 1, 42, NULL, SANE_TRUE , 0x28, 0x03},
|
||||
{CCD_5345 , 400, 3, 400, 11000, 800, 1, 42, NULL, SANE_TRUE , 0x28, 0x03},
|
||||
{CCD_5345 , 600, 3, 600, 11000,1200, 1, 42, NULL, SANE_TRUE , 0x28, 0x03},
|
||||
{CCD_5345 ,1200, 3, 1200, 11000,1200, 1, 42, NULL, SANE_FALSE, 0x30, 0x03},
|
||||
{CCD_5345 ,2400, 3, 1200, 11000,1200, 1, 42, NULL, SANE_FALSE, 0x30, 0x03},
|
||||
{CCD_5345 , 50, 1, 50, 12000, 100, 1, 42, NULL, SANE_TRUE , 0x28, 0x03},
|
||||
{CCD_5345 , 75, 1, 75, 11000, 150, 1, 42, NULL, SANE_TRUE , 0x28, 0x03},
|
||||
{CCD_5345 , 100, 1, 100, 11000, 200, 1, 42, NULL, SANE_TRUE , 0x28, 0x03},
|
||||
{CCD_5345 , 150, 1, 150, 11000, 300, 1, 42, NULL, SANE_TRUE , 0x28, 0x03},
|
||||
{CCD_5345 , 200, 1, 200, 11000, 400, 1, 42, NULL, SANE_TRUE , 0x28, 0x03},
|
||||
{CCD_5345 , 300, 1, 300, 11000, 600, 1, 42, NULL, SANE_TRUE , 0x28, 0x03},
|
||||
{CCD_5345 , 400, 1, 400, 11000, 800, 1, 42, NULL, SANE_TRUE , 0x28, 0x03},
|
||||
{CCD_5345 , 600, 1, 600, 11000,1200, 1, 42, NULL, SANE_TRUE , 0x28, 0x03},
|
||||
{CCD_5345 ,1200, 1, 1200, 11000,1200, 1, 42, NULL, SANE_FALSE, 0x30, 0x03},
|
||||
{CCD_5345 ,2400, 1, 1200, 11000,1200, 1, 42, NULL, SANE_FALSE, 0x30, 0x03},
|
||||
{CCD_5345 , 50, 3, 50, 12000, 100, 1, 42, NULL, 2, 0x28, 0x03},
|
||||
{CCD_5345 , 75, 3, 75, 11000, 150, 1, 42, NULL, 2, 0x28, 0x03},
|
||||
{CCD_5345 , 100, 3, 100, 11000, 200, 1, 42, NULL, 2, 0x28, 0x03},
|
||||
{CCD_5345 , 150, 3, 150, 11000, 300, 1, 42, NULL, 2, 0x28, 0x03},
|
||||
{CCD_5345 , 200, 3, 200, 11000, 400, 1, 42, NULL, 2, 0x28, 0x03},
|
||||
{CCD_5345 , 300, 3, 300, 11000, 600, 1, 42, NULL, 2, 0x28, 0x03},
|
||||
{CCD_5345 , 400, 3, 400, 11000, 800, 1, 42, NULL, 2, 0x28, 0x03},
|
||||
{CCD_5345 , 600, 3, 600, 11000,1200, 1, 42, NULL, 2, 0x28, 0x03},
|
||||
{CCD_5345 ,1200, 3, 1200, 11000,1200, 1, 42, NULL, 1, 0x30, 0x03},
|
||||
{CCD_5345 ,2400, 3, 1200, 11000,1200, 1, 42, NULL, 1, 0x30, 0x03},
|
||||
{CCD_5345 , 50, 1, 50, 12000, 100, 1, 42, NULL, 2, 0x28, 0x03},
|
||||
{CCD_5345 , 75, 1, 75, 11000, 150, 1, 42, NULL, 2, 0x28, 0x03},
|
||||
{CCD_5345 , 100, 1, 100, 11000, 200, 1, 42, NULL, 2, 0x28, 0x03},
|
||||
{CCD_5345 , 150, 1, 150, 11000, 300, 1, 42, NULL, 2, 0x28, 0x03},
|
||||
{CCD_5345 , 200, 1, 200, 11000, 400, 1, 42, NULL, 2, 0x28, 0x03},
|
||||
{CCD_5345 , 300, 1, 300, 11000, 600, 1, 42, NULL, 2, 0x28, 0x03},
|
||||
{CCD_5345 , 400, 1, 400, 11000, 800, 1, 42, NULL, 2, 0x28, 0x03},
|
||||
{CCD_5345 , 600, 1, 600, 11000,1200, 1, 42, NULL, 2, 0x28, 0x03},
|
||||
{CCD_5345 ,1200, 1, 1200, 11000,1200, 1, 42, NULL, 2, 0x30, 0x03},
|
||||
{CCD_5345 ,2400, 1, 1200, 11000,1200, 1, 42, NULL, 1, 0x30, 0x03},
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ gl841_test_motor_flag_bit (SANE_Byte val)
|
|||
/* *dev : device infos
|
||||
*regs : registers to be set
|
||||
extended : do extended set up
|
||||
half_ccd: set up for half ccd resolution
|
||||
ccd_size_divisor: set up for half ccd resolution
|
||||
all registers 08-0B, 10-1D, 52-59 are set up. They shouldn't
|
||||
appear anywhere else but in register_ini
|
||||
|
||||
|
@ -187,7 +187,7 @@ other register settings depending on this:
|
|||
*/
|
||||
static void sanei_gl841_setup_sensor(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
||||
Genesys_Register_Set * regs,
|
||||
SANE_Bool extended, SANE_Bool half_ccd)
|
||||
SANE_Bool extended, unsigned ccd_size_divisor)
|
||||
{
|
||||
DBG(DBG_proc, "%s\n", __func__);
|
||||
|
||||
|
@ -215,8 +215,7 @@ static void sanei_gl841_setup_sensor(Genesys_Device * dev, const Genesys_Sensor&
|
|||
2 kind of settings */
|
||||
if (dev->model->ccd_type == CCD_5345)
|
||||
{
|
||||
if (half_ccd)
|
||||
{
|
||||
if (ccd_size_divisor > 1) {
|
||||
GenesysRegister* r;
|
||||
/* settings for CCD used at half is max resolution */
|
||||
r = sanei_genesys_get_address (regs, 0x70);
|
||||
|
@ -254,8 +253,7 @@ static void sanei_gl841_setup_sensor(Genesys_Device * dev, const Genesys_Sensor&
|
|||
{
|
||||
/* settings for CCD used at half is max resolution */
|
||||
GenesysRegister* r;
|
||||
if (half_ccd)
|
||||
{
|
||||
if (ccd_size_divisor > 1) {
|
||||
r = sanei_genesys_get_address (regs, 0x70);
|
||||
r->value = 0x16;
|
||||
r = sanei_genesys_get_address (regs, 0x71);
|
||||
|
@ -521,7 +519,7 @@ gl841_init_lide80 (Genesys_Device * dev)
|
|||
dev->reg.find_reg(0x6c).value |= REG6B_GPO18;
|
||||
dev->reg.find_reg(0x6c).value &= ~REG6B_GPO17;
|
||||
|
||||
sanei_gl841_setup_sensor(dev, sensor, &dev->reg, 0, 0);
|
||||
sanei_gl841_setup_sensor(dev, sensor, &dev->reg, 0, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -657,7 +655,7 @@ gl841_init_registers (Genesys_Device * dev)
|
|||
/*STOPTIM*/
|
||||
dev->reg.find_reg(0x5e).value |= 0x2 << REG5ES_STOPTIM;
|
||||
|
||||
sanei_gl841_setup_sensor(dev, sensor, &dev->reg, 0, 0);
|
||||
sanei_gl841_setup_sensor(dev, sensor, &dev->reg, 0, 1);
|
||||
|
||||
/* set up GPIO */
|
||||
dev->reg.find_reg(0x6c).value = dev->gpo.value[0];
|
||||
|
@ -1469,12 +1467,13 @@ static void gl841_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
Genesys_Register_Set* reg, unsigned int exposure_time,
|
||||
unsigned int used_res, unsigned int start,
|
||||
unsigned int pixels, int channels,
|
||||
int depth, SANE_Bool half_ccd, ColorFilter color_filter,
|
||||
int flags)
|
||||
int depth, unsigned ccd_size_divisor,
|
||||
ColorFilter color_filter, int flags)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "exposure_time=%d, used_res=%d, start=%d, pixels=%d, channels=%d, "
|
||||
"depth=%d, half_ccd=%d, flags=%x",
|
||||
exposure_time, used_res, start, pixels, channels, depth, half_ccd, flags);
|
||||
"depth=%d, ccd_size_divisor=%d, flags=%x",
|
||||
exposure_time, used_res, start, pixels, channels, depth, ccd_size_divisor,
|
||||
flags);
|
||||
unsigned int words_per_line;
|
||||
unsigned int end;
|
||||
unsigned int dpiset;
|
||||
|
@ -1489,39 +1488,34 @@ static void gl841_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
used_res = used_res * gl841_get_dpihw(dev) / sensor.optical_res;
|
||||
|
||||
/*
|
||||
with half_ccd the optical resolution of the ccd is halved. We don't apply this
|
||||
with ccd_size_divisor==2 the optical resolution of the ccd is halved. We don't apply this
|
||||
to dpihw, so we need to double dpiset.
|
||||
|
||||
For the scanner only the ratio of dpiset and dpihw is of relevance to scale
|
||||
down properly.
|
||||
*/
|
||||
if (half_ccd)
|
||||
dpiset = used_res * 2;
|
||||
else
|
||||
dpiset = used_res;
|
||||
dpiset = used_res * ccd_size_divisor;
|
||||
|
||||
/* gpio part.*/
|
||||
if (dev->model->gpo_type == GPO_CANONLIDE35)
|
||||
{
|
||||
r = sanei_genesys_get_address (reg, REG6C);
|
||||
if (half_ccd)
|
||||
r->value &= ~0x80;
|
||||
else
|
||||
r->value |= 0x80;
|
||||
if (ccd_size_divisor > 1) {
|
||||
r->value &= ~0x80;
|
||||
} else {
|
||||
r->value |= 0x80;
|
||||
}
|
||||
}
|
||||
if (dev->model->gpo_type == GPO_CANONLIDE80)
|
||||
{
|
||||
r = sanei_genesys_get_address (reg, REG6C);
|
||||
if (half_ccd)
|
||||
{
|
||||
if (ccd_size_divisor > 1) {
|
||||
r->value &= ~0x40;
|
||||
r->value |= 0x20;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
r->value &= ~0x20;
|
||||
r->value |= 0x40;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* enable shading */
|
||||
|
@ -1630,7 +1624,7 @@ static void gl841_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
r->value |= REG05_GMMENB;
|
||||
|
||||
/* sensor parameters */
|
||||
sanei_gl841_setup_sensor(dev, sensor, &dev->reg, 1, half_ccd);
|
||||
sanei_gl841_setup_sensor(dev, sensor, &dev->reg, 1, ccd_size_divisor);
|
||||
|
||||
r = sanei_genesys_get_address (reg, 0x29);
|
||||
r->value = 255; /*<<<"magic" number, only suitable for cis*/
|
||||
|
@ -1791,7 +1785,6 @@ static void gl841_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
int max_shift;
|
||||
size_t requested_buffer_size, read_buffer_size;
|
||||
|
||||
SANE_Bool half_ccd; /* false: full CCD res is used, true, half max CCD res is used */
|
||||
int optical_res;
|
||||
unsigned int oflags; /**> optical flags */
|
||||
|
||||
|
@ -1801,7 +1794,6 @@ static void gl841_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
results:
|
||||
|
||||
for scanner:
|
||||
half_ccd
|
||||
start
|
||||
end
|
||||
dpiset
|
||||
|
@ -1826,26 +1818,20 @@ independent of our calculated values:
|
|||
dev->bytes_to_read
|
||||
*/
|
||||
|
||||
/* half_ccd */
|
||||
/* we have 2 domains for ccd: xres below or above half ccd max dpi */
|
||||
if (sensor.get_ccd_size_divisor_for_dpi(params.xres) > 1) {
|
||||
half_ccd = SANE_TRUE;
|
||||
} else {
|
||||
half_ccd = SANE_FALSE;
|
||||
}
|
||||
unsigned ccd_size_divisor = sensor.get_ccd_size_divisor_for_dpi(params.xres);
|
||||
|
||||
/* optical_res */
|
||||
|
||||
optical_res = sensor.optical_res;
|
||||
if (half_ccd)
|
||||
optical_res /= 2;
|
||||
optical_res = sensor.optical_res / ccd_size_divisor;
|
||||
|
||||
/* stagger */
|
||||
|
||||
if ((!half_ccd) && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE))
|
||||
stagger = (4 * params.yres) / dev->motor.base_ydpi;
|
||||
else
|
||||
stagger = 0;
|
||||
if (ccd_size_divisor == 1 && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE)) {
|
||||
stagger = (4 * params.yres) / dev->motor.base_ydpi;
|
||||
} else {
|
||||
stagger = 0;
|
||||
}
|
||||
DBG(DBG_info, "%s : stagger=%d lines\n", __func__, stagger);
|
||||
|
||||
/* used_res */
|
||||
|
@ -1980,8 +1966,8 @@ dummy \ scanned lines
|
|||
}
|
||||
|
||||
gl841_init_optical_regs_scan(dev, sensor, reg, exposure_time, used_res, start, used_pixels,
|
||||
params.channels, params.depth, half_ccd, params.color_filter,
|
||||
oflags);
|
||||
params.channels, params.depth, ccd_size_divisor,
|
||||
params.color_filter, oflags);
|
||||
|
||||
/*** motor parameters ***/
|
||||
|
||||
|
@ -2060,7 +2046,7 @@ dummy \ scanned lines
|
|||
dev->current_setup.exposure_time = exposure_time;
|
||||
dev->current_setup.xres = used_res;
|
||||
dev->current_setup.yres = params.yres;
|
||||
dev->current_setup.ccd_size_divisor = half_ccd ? 2 : 1;
|
||||
dev->current_setup.ccd_size_divisor = ccd_size_divisor;
|
||||
dev->current_setup.stagger = stagger;
|
||||
dev->current_setup.max_shift = max_shift + stagger;
|
||||
|
||||
|
@ -2112,7 +2098,6 @@ static void gl841_calculate_current_setup(Genesys_Device * dev, const Genesys_Se
|
|||
int scan_step_type = 1;
|
||||
int max_shift;
|
||||
|
||||
SANE_Bool half_ccd; /* false: full CCD res is used, true, half max CCD res is used */
|
||||
int optical_res;
|
||||
|
||||
DBG(DBG_info, "%s ", __func__);
|
||||
|
@ -2153,26 +2138,20 @@ static void gl841_calculate_current_setup(Genesys_Device * dev, const Genesys_Se
|
|||
DBG(DBG_info, "%s ", __func__);
|
||||
debug_dump(DBG_info, params);
|
||||
|
||||
/* half_ccd */
|
||||
/* we have 2 domains for ccd: xres below or above half ccd max dpi */
|
||||
if (sensor.get_ccd_size_divisor_for_dpi(params.xres) > 1) {
|
||||
half_ccd = SANE_TRUE;
|
||||
} else {
|
||||
half_ccd = SANE_FALSE;
|
||||
}
|
||||
unsigned ccd_size_divisor = sensor.get_ccd_size_divisor_for_dpi(params.xres);
|
||||
|
||||
/* optical_res */
|
||||
|
||||
optical_res = sensor.optical_res;
|
||||
if (half_ccd)
|
||||
optical_res /= 2;
|
||||
optical_res = sensor.optical_res / ccd_size_divisor;
|
||||
|
||||
/* stagger */
|
||||
|
||||
if ((!half_ccd) && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE))
|
||||
stagger = (4 * params.yres) / dev->motor.base_ydpi;
|
||||
else
|
||||
stagger = 0;
|
||||
if (ccd_size_divisor == 1 && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE)) {
|
||||
stagger = (4 * params.yres) / dev->motor.base_ydpi;
|
||||
} else {
|
||||
stagger = 0;
|
||||
}
|
||||
DBG(DBG_info, "%s: stagger=%d lines\n", __func__, stagger);
|
||||
|
||||
/* used_res */
|
||||
|
@ -2280,7 +2259,7 @@ dummy \ scanned lines
|
|||
dev->current_setup.exposure_time = exposure_time;
|
||||
dev->current_setup.xres = used_res;
|
||||
dev->current_setup.yres = params.yres;
|
||||
dev->current_setup.ccd_size_divisor = half_ccd ? 2 : 1;
|
||||
dev->current_setup.ccd_size_divisor = ccd_size_divisor;
|
||||
dev->current_setup.stagger = stagger;
|
||||
dev->current_setup.max_shift = max_shift + stagger;
|
||||
}
|
||||
|
|
|
@ -776,12 +776,12 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev,
|
|||
static void gl846_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||
Genesys_Register_Set* reg, unsigned int exposure_time,
|
||||
int used_res, unsigned int start, unsigned int pixels,
|
||||
int channels, int depth, SANE_Bool half_ccd,
|
||||
int channels, int depth,
|
||||
ColorFilter color_filter, int flags)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "exposure_time=%d, used_res=%d, start=%d, pixels=%d, channels=%d, depth=%d, "
|
||||
"half_ccd=%d, flags=%x",
|
||||
exposure_time, used_res, start, pixels, channels, depth, half_ccd, flags);
|
||||
"flags=%x",
|
||||
exposure_time, used_res, start, pixels, channels, depth, flags);
|
||||
unsigned int words_per_line;
|
||||
unsigned int dpiset, dpihw, segnb, factor;
|
||||
unsigned int bytes;
|
||||
|
@ -1025,31 +1025,21 @@ static void gl846_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
int max_shift;
|
||||
size_t requested_buffer_size, read_buffer_size;
|
||||
|
||||
SANE_Bool half_ccd; /* false: full CCD res is used, true, half max CCD res is used */
|
||||
int optical_res;
|
||||
|
||||
debug_dump(DBG_info, params);
|
||||
|
||||
/* we may have 2 domains for ccd: xres below or above half ccd max dpi */
|
||||
if (sensor.get_ccd_size_divisor_for_dpi(params.xres) > 1)
|
||||
{
|
||||
half_ccd = SANE_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
half_ccd = SANE_FALSE;
|
||||
}
|
||||
// we may have 2 domains for ccd: xres below or above half ccd max dpi
|
||||
unsigned ccd_size_divisor = sensor.get_ccd_size_divisor_for_dpi(params.xres);
|
||||
|
||||
/* optical_res */
|
||||
optical_res = sensor.optical_res;
|
||||
if (half_ccd)
|
||||
optical_res /= 2;
|
||||
optical_res = sensor.optical_res / ccd_size_divisor;
|
||||
|
||||
/* stagger */
|
||||
if ((!half_ccd) && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE))
|
||||
stagger = (4 * params.yres) / dev->motor.base_ydpi;
|
||||
else
|
||||
stagger = 0;
|
||||
if (ccd_size_divisor == 1 && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE)) {
|
||||
stagger = (4 * params.yres) / dev->motor.base_ydpi;
|
||||
} else {
|
||||
stagger = 0;
|
||||
}
|
||||
DBG(DBG_info, "%s : stagger=%d lines\n", __func__, stagger);
|
||||
|
||||
/* used_res */
|
||||
|
@ -1123,7 +1113,7 @@ static void gl846_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
}
|
||||
|
||||
gl846_init_optical_regs_scan(dev, sensor, reg, exposure_time, used_res, start, used_pixels,
|
||||
params.channels, params.depth, half_ccd, params.color_filter,
|
||||
params.channels, params.depth, params.color_filter,
|
||||
oflags);
|
||||
|
||||
/*** motor parameters ***/
|
||||
|
@ -1187,7 +1177,7 @@ static void gl846_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
dev->current_setup.exposure_time = exposure_time;
|
||||
dev->current_setup.xres = used_res;
|
||||
dev->current_setup.yres = params.yres;
|
||||
dev->current_setup.ccd_size_divisor = half_ccd ? 2 : 1;
|
||||
dev->current_setup.ccd_size_divisor = ccd_size_divisor;
|
||||
dev->current_setup.stagger = stagger;
|
||||
dev->current_setup.max_shift = max_shift + stagger;
|
||||
|
||||
|
@ -1237,7 +1227,6 @@ gl846_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
int dummy = 0;
|
||||
int max_shift;
|
||||
|
||||
SANE_Bool half_ccd; /* false: full CCD res is used, true, half max CCD res is used */
|
||||
int optical_res;
|
||||
|
||||
DBG(DBG_info, "%s ", __func__);
|
||||
|
@ -1277,13 +1266,8 @@ gl846_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
DBG(DBG_info, "%s ", __func__);
|
||||
debug_dump(DBG_info, params);
|
||||
|
||||
/* half_ccd */
|
||||
/* we have 2 domains for ccd: xres below or above half ccd max dpi */
|
||||
if (sensor.get_ccd_size_divisor_for_dpi(params.xres) > 1) {
|
||||
half_ccd = SANE_TRUE;
|
||||
} else {
|
||||
half_ccd = SANE_FALSE;
|
||||
}
|
||||
// we have 2 domains for ccd: xres below or above half ccd max dpi
|
||||
unsigned ccd_size_divisor = sensor.get_ccd_size_divisor_for_dpi(params.xres);
|
||||
|
||||
/* optical_res */
|
||||
optical_res = sensor.optical_res;
|
||||
|
@ -1332,7 +1316,7 @@ gl846_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
dev->current_setup.exposure_time = exposure_time;
|
||||
dev->current_setup.xres = used_res;
|
||||
dev->current_setup.yres = params.yres;
|
||||
dev->current_setup.ccd_size_divisor = half_ccd ? 2 : 1;
|
||||
dev->current_setup.ccd_size_divisor = ccd_size_divisor;
|
||||
dev->current_setup.stagger = stagger;
|
||||
dev->current_setup.max_shift = max_shift + stagger;
|
||||
}
|
||||
|
|
|
@ -791,12 +791,12 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev,
|
|||
static void gl847_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||
Genesys_Register_Set* reg, unsigned int exposure_time,
|
||||
int used_res, unsigned int start, unsigned int pixels,
|
||||
int channels, int depth, SANE_Bool half_ccd,
|
||||
int channels, int depth,
|
||||
ColorFilter color_filter, int flags)
|
||||
{
|
||||
DBG_HELPER_ARGS(dbg, "exposure_time=%d, used_res=%d, start=%d, pixels=%d, channels=%d, "
|
||||
"depth=%d, half_ccd=%d, flags=%x",
|
||||
exposure_time, used_res, start, pixels, channels, depth, half_ccd, flags);
|
||||
"depth=%d, flags=%x",
|
||||
exposure_time, used_res, start, pixels, channels, depth, flags);
|
||||
unsigned int words_per_line;
|
||||
unsigned dpiset, dpihw, segnb, factor;
|
||||
unsigned int bytes;
|
||||
|
@ -1041,31 +1041,21 @@ static void gl847_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
int max_shift;
|
||||
size_t requested_buffer_size, read_buffer_size;
|
||||
|
||||
SANE_Bool half_ccd; /* false: full CCD res is used, true, half max CCD res is used */
|
||||
int optical_res;
|
||||
|
||||
debug_dump(DBG_info, params);
|
||||
|
||||
/* we may have 2 domains for ccd: xres below or above half ccd max dpi */
|
||||
if (sensor.get_ccd_size_divisor_for_dpi(params.xres) > 1)
|
||||
{
|
||||
half_ccd = SANE_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
half_ccd = SANE_FALSE;
|
||||
}
|
||||
// we may have 2 domains for ccd: xres below or above half ccd max dpi */
|
||||
unsigned ccd_size_divisor = sensor.get_ccd_size_divisor_for_dpi(params.xres);
|
||||
|
||||
/* optical_res */
|
||||
optical_res = sensor.optical_res;
|
||||
if (half_ccd)
|
||||
optical_res /= 2;
|
||||
optical_res = sensor.optical_res / ccd_size_divisor;
|
||||
|
||||
/* stagger */
|
||||
if ((!half_ccd) && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE))
|
||||
stagger = (4 * params.yres) / dev->motor.base_ydpi;
|
||||
else
|
||||
stagger = 0;
|
||||
if (ccd_size_divisor == 1 && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE)) {
|
||||
stagger = (4 * params.yres) / dev->motor.base_ydpi;
|
||||
} else {
|
||||
stagger = 0;
|
||||
}
|
||||
DBG(DBG_info, "%s : stagger=%d lines\n", __func__, stagger);
|
||||
|
||||
/* used_res */
|
||||
|
@ -1139,8 +1129,7 @@ static void gl847_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
}
|
||||
|
||||
gl847_init_optical_regs_scan(dev, sensor, reg, exposure_time, used_res, start, used_pixels,
|
||||
params.channels, params.depth, half_ccd, params.color_filter,
|
||||
oflags);
|
||||
params.channels, params.depth, params.color_filter, oflags);
|
||||
|
||||
/*** motor parameters ***/
|
||||
|
||||
|
@ -1203,7 +1192,7 @@ static void gl847_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
dev->current_setup.exposure_time = exposure_time;
|
||||
dev->current_setup.xres = used_res;
|
||||
dev->current_setup.yres = params.yres;
|
||||
dev->current_setup.ccd_size_divisor = half_ccd ? 2 : 1;
|
||||
dev->current_setup.ccd_size_divisor = ccd_size_divisor;
|
||||
dev->current_setup.stagger = stagger;
|
||||
dev->current_setup.max_shift = max_shift + stagger;
|
||||
|
||||
|
@ -1253,7 +1242,6 @@ gl847_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
int dummy = 0;
|
||||
int max_shift;
|
||||
|
||||
SANE_Bool half_ccd; /* false: full CCD res is used, true, half max CCD res is used */
|
||||
int optical_res;
|
||||
|
||||
DBG(DBG_info, "%s ", __func__);
|
||||
|
@ -1292,13 +1280,8 @@ gl847_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
DBG(DBG_info, "%s ", __func__);
|
||||
debug_dump(DBG_info, params);
|
||||
|
||||
/* half_ccd */
|
||||
/* we have 2 domains for ccd: xres below or above half ccd max dpi */
|
||||
if (sensor.get_ccd_size_divisor_for_dpi(params.xres) > 1) {
|
||||
half_ccd = SANE_TRUE;
|
||||
} else {
|
||||
half_ccd = SANE_FALSE;
|
||||
}
|
||||
// we have 2 domains for ccd: xres below or above half ccd max dpi
|
||||
unsigned ccd_size_divisor = sensor.get_ccd_size_divisor_for_dpi(params.xres);
|
||||
|
||||
/* optical_res */
|
||||
optical_res = sensor.optical_res;
|
||||
|
@ -1349,7 +1332,7 @@ gl847_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
dev->current_setup.exposure_time = exposure_time;
|
||||
dev->current_setup.xres = used_res;
|
||||
dev->current_setup.yres = params.yres;
|
||||
dev->current_setup.ccd_size_divisor = half_ccd ? 2 : 1;
|
||||
dev->current_setup.ccd_size_divisor = ccd_size_divisor;
|
||||
dev->current_setup.stagger = stagger;
|
||||
dev->current_setup.max_shift = max_shift + stagger;
|
||||
}
|
||||
|
|
|
@ -1484,7 +1484,7 @@ bool sanei_genesys_is_compatible_calibration(Genesys_Device * dev, const Genesys
|
|||
DBG (DBG_io, "%s: after resolution check current compatible=%d\n", __func__, compatible);
|
||||
if (dev->current_setup.ccd_size_divisor != cache->used_setup.ccd_size_divisor)
|
||||
{
|
||||
DBG (DBG_io, "%s: half_ccd=%d, used=%d\n", __func__,
|
||||
DBG (DBG_io, "%s: ccd_size_divisor=%d, used=%d\n", __func__,
|
||||
dev->current_setup.ccd_size_divisor, cache->used_setup.ccd_size_divisor);
|
||||
compatible = 0;
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue