genesys: Simplify shading upload on gl843

merge-requests/122/head
Povilas Kanapickas 2019-08-04 13:17:52 +03:00
rodzic 2df86f551f
commit ca54462bd2
1 zmienionych plików z 8 dodań i 11 usunięć

Wyświetl plik

@ -3740,7 +3740,7 @@ static void gl843_send_shading_data(Genesys_Device* dev, const Genesys_Sensor& s
uint8_t *buffer; uint8_t *buffer;
int count,offset; int count,offset;
GenesysRegister *r; GenesysRegister *r;
uint16_t dpiset, strpixel, endpixel, startx, factor; uint16_t strpixel, endpixel, startx;
offset=0; offset=0;
length=size; length=size;
@ -3749,22 +3749,19 @@ static void gl843_send_shading_data(Genesys_Device* dev, const Genesys_Sensor& s
{ {
/* recompute STRPIXEL used shading calibration so we can /* recompute STRPIXEL used shading calibration so we can
* compute offset within data for SHDAREA case */ * compute offset within data for SHDAREA case */
r = sanei_genesys_get_address(&dev->reg, REG18);
dpiset = dev->reg.get16(REG_DPISET);
factor = sensor.optical_res / sensor.get_register_hwdpi(dpiset);
/* start coordinate in optical dpi coordinates */ // FIXME: the following is likely incorrect
startx = (sensor.dummy_pixel / sensor.ccd_pixels_per_system_pixel()) / factor; // start coordinate in optical dpi coordinates
startx = (sensor.dummy_pixel / sensor.ccd_pixels_per_system_pixel()) / dev->session.hwdpi_divisor;
/* current scan coordinates */ /* current scan coordinates */
strpixel = dev->reg.get16(REG_STRPIXEL); strpixel = dev->session.pixel_startx;
endpixel = dev->reg.get16(REG_ENDPIXEL); endpixel = dev->session.pixel_endx;
if (dev->model->model_id == MODEL_CANON_CANOSCAN_8600F) if (dev->model->model_id == MODEL_CANON_CANOSCAN_8600F)
{ {
int optical_res = sensor.optical_res / dev->current_setup.ccd_size_divisor; int dpiset_real = dev->session.output_resolution * sensor.ccd_pixels_per_system_pixel();
int dpiset_real = dpiset / dev->current_setup.ccd_size_divisor; int half_ccd_factor = dev->session.optical_resolution / sensor.get_logical_hwdpi(dpiset_real);
int half_ccd_factor = optical_res / sensor.get_logical_hwdpi(dpiset_real);
strpixel /= half_ccd_factor; strpixel /= half_ccd_factor;
endpixel /= half_ccd_factor; endpixel /= half_ccd_factor;
} }