genesys: Fix calibration size calculation for 8600F

The current approach of marking the scanner as
GENESYS_FLAG_FULL_HWDPI_MODE is counter-productive, because only the
register value is always full DPI, the actual resolution is different.
For now, let's just work around this by having a special case for the
scanner.
merge-requests/79/head
Povilas Kanapickas 2019-05-18 14:56:12 +03:00
rodzic 0a0a140423
commit c536f3cf70
3 zmienionych plików z 41 dodań i 4 usunięć

Wyświetl plik

@ -2999,7 +2999,7 @@ gl843_init_regs_for_shading (Genesys_Device * dev)
dev->calib_lines = dev->model->shading_ta_lines; dev->calib_lines = dev->model->shading_ta_lines;
else else
dev->calib_lines = dev->model->shading_lines; dev->calib_lines = dev->model->shading_lines;
dpihw=sanei_genesys_compute_dpihw(dev,dev->settings.xres); dpihw=sanei_genesys_compute_dpihw_calibration(dev,dev->settings.xres);
factor=dev->sensor.optical_res/dpihw; factor=dev->sensor.optical_res/dpihw;
resolution=dpihw; resolution=dpihw;
@ -3455,7 +3455,7 @@ gl843_offset_calibration (Genesys_Device * dev)
bpp = 8; bpp = 8;
/* compute divider factor to compute final pixels number */ /* compute divider factor to compute final pixels number */
dpihw = sanei_genesys_compute_dpihw (dev, dev->settings.xres); dpihw = sanei_genesys_compute_dpihw_calibration (dev, dev->settings.xres);
factor = dev->sensor.optical_res / dpihw; factor = dev->sensor.optical_res / dpihw;
resolution = dpihw; resolution = dpihw;
@ -3663,7 +3663,7 @@ gl843_coarse_gain_calibration (Genesys_Device * dev, int dpi)
int bpp; int bpp;
DBG(DBG_proc, "%s: dpi = %d\n", __func__, dpi); DBG(DBG_proc, "%s: dpi = %d\n", __func__, dpi);
dpihw=sanei_genesys_compute_dpihw(dev, dpi); dpihw=sanei_genesys_compute_dpihw_calibration(dev, dpi);
factor=dev->sensor.optical_res/dpihw; factor=dev->sensor.optical_res/dpihw;
/* coarse gain calibration is always done in color mode */ /* coarse gain calibration is always done in color mode */
@ -3848,7 +3848,8 @@ gl843_init_regs_for_warmup (Genesys_Device * dev,
/* setup scan */ /* setup scan */
*channels=3; *channels=3;
resolution=600; resolution=600;
dpihw=sanei_genesys_compute_dpihw(dev, resolution); dpihw=sanei_genesys_compute_dpihw_calibration(dev, resolution);
resolution=dpihw;
factor=dev->sensor.optical_res/dpihw; factor=dev->sensor.optical_res/dpihw;
num_pixels=dev->sensor.sensor_pixels/(factor*2); num_pixels=dev->sensor.sensor_pixels/(factor*2);
*total_size = num_pixels * 3 * 1; *total_size = num_pixels * 3 * 1;
@ -4415,6 +4416,16 @@ gl843_send_shading_data (Genesys_Device * dev, uint8_t * data, int size)
strpixel*=tgtime; strpixel*=tgtime;
endpixel*=tgtime; endpixel*=tgtime;
if (dev->model->model_id == MODEL_CANON_CANOSCAN_8600F && dev->current_setup.half_ccd)
{
int optical_res = dev->sensor.optical_res / 4;
int dpiset_real = dpiset / 4;
int half_ccd_factor = optical_res /
sanei_genesys_compute_dpihw_calibration(dev, dpiset_real);
strpixel /= half_ccd_factor;
endpixel /= half_ccd_factor;
}
/* 16 bit words, 2 words per color, 3 color channels */ /* 16 bit words, 2 words per color, 3 color channels */
offset=(strpixel-startx)*2*2*3; offset=(strpixel-startx)*2*2*3;
length=(endpixel-strpixel)*2*2*3; length=(endpixel-strpixel)*2*2*3;

Wyświetl plik

@ -1787,6 +1787,29 @@ int sanei_genesys_compute_dpihw(Genesys_Device *dev, int xres)
return dev->sensor.optical_res; return dev->sensor.optical_res;
} }
// sanei_genesys_compute_dpihw returns the dpihw that is written to register.
// However the number of pixels depends on half_ccd mode
int sanei_genesys_compute_dpihw_calibration(Genesys_Device *dev, int xres)
{
if (dev->model->model_id == MODEL_CANON_CANOSCAN_8600F)
{
// real resolution is half of the "official" resolution - half_ccd mode
int hwres = dev->sensor.optical_res / 4;
if (xres <= hwres / 4)
{
return hwres / 4;
}
if (xres <= hwres / 2)
{
return hwres / 2;
}
return hwres;
}
return sanei_genesys_compute_dpihw(dev, xres);
}
/** @brief motor profile /** @brief motor profile
* search for the database of motor profiles and get the best one. Each * search for the database of motor profiles and get the best one. Each
* profile is at full step and at a reference exposure. Use first entry * profile is at full step and at a reference exposure. Use first entry

Wyświetl plik

@ -1267,6 +1267,9 @@ sanei_genesys_asic_init(Genesys_Device *dev, SANE_Bool cold);
extern extern
int sanei_genesys_compute_dpihw(Genesys_Device *dev, int xres); int sanei_genesys_compute_dpihw(Genesys_Device *dev, int xres);
extern
int sanei_genesys_compute_dpihw_calibration(Genesys_Device *dev, int xres);
extern extern
Motor_Profile *sanei_genesys_get_motor_profile(Motor_Profile *motors, int motor_type, int exposure); Motor_Profile *sanei_genesys_get_motor_profile(Motor_Profile *motors, int motor_type, int exposure);