kopia lustrzana https://gitlab.com/sane-project/backends
rodzic
2a6872c385
commit
1265e26d61
|
@ -4374,7 +4374,8 @@ genesys_start_scan (Genesys_Device * dev)
|
|||
|
||||
/* GL124 is using SHDAREA, so we have to wait for scan to be set up before
|
||||
* sending shading data */
|
||||
if(dev->model->cmd_set->send_shading_data!=NULL)
|
||||
if( (dev->model->cmd_set->send_shading_data!=NULL)
|
||||
&& !(dev->model->flags & GENESYS_FLAG_NO_CALIBRATION))
|
||||
{
|
||||
status = genesys_send_shading_coefficient (dev);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
|
@ -4641,96 +4642,6 @@ static SANE_Status accurate_line_read(Genesys_Device * dev,
|
|||
}
|
||||
#endif
|
||||
|
||||
/** @brief fill buffer for odd/even sensors
|
||||
* This function fills a read buffer with scanned data from a sensor
|
||||
* which puts odd and even pixels in 2 different data segment. So a complete
|
||||
* must be read and bytes interleaved to get usable by the other stages
|
||||
* of the backend
|
||||
*/
|
||||
static SANE_Status
|
||||
genesys_fill_oe_buffer (Genesys_Device * dev, uint8_t *work_buffer_dst, size_t size)
|
||||
{
|
||||
size_t count;
|
||||
SANE_Status status;
|
||||
|
||||
/* fill buffer if needed */
|
||||
if (dev->oe_buffer.avail == 0)
|
||||
{
|
||||
status = accurate_line_read(dev,dev->oe_buffer.buffer,dev->oe_buffer.size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (DBG_error,
|
||||
"%s: failed to read %lu bytes (%s)\n", __FUNCTION__,
|
||||
(u_long) dev->oe_buffer.size, sane_strstatus (status));
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/* copy size bytes of data, copying from a subwindow of each line
|
||||
* when last line of buffer is exhausted, read another one */
|
||||
count = 0;
|
||||
while (count < size)
|
||||
{
|
||||
if(dev->settings.double_xres==SANE_TRUE)
|
||||
{
|
||||
/* copy only even pixel */
|
||||
work_buffer_dst[count] = dev->oe_buffer.buffer[dev->cur + dev->skip + dev->oe_buffer.pos];
|
||||
/* update counter and pointer */
|
||||
count++;
|
||||
dev->cur++;
|
||||
}
|
||||
else if(dev->settings.depth==8 && dev->settings.double_xres==SANE_FALSE)
|
||||
{
|
||||
while (dev->cur < dev->len && count < size)
|
||||
{
|
||||
/* copy even pixel */
|
||||
work_buffer_dst[count] = dev->oe_buffer.buffer[dev->cur + dev->skip + dev->oe_buffer.pos];
|
||||
/* copy odd pixel */
|
||||
work_buffer_dst[count + 1] = dev->oe_buffer.buffer[dev->cur + dev->skip + dev->dist + dev->oe_buffer.pos];
|
||||
/* update counter and pointer */
|
||||
count += 2;
|
||||
dev->cur++;
|
||||
}
|
||||
}
|
||||
else if(dev->settings.depth==16 && dev->settings.double_xres==SANE_FALSE)
|
||||
{
|
||||
while (dev->cur < dev->len && count < size)
|
||||
{
|
||||
/* copy even pixel */
|
||||
work_buffer_dst[count] = dev->oe_buffer.buffer[dev->cur + dev->skip + dev->oe_buffer.pos];
|
||||
work_buffer_dst[count+1] = dev->oe_buffer.buffer[dev->cur + dev->skip + dev->oe_buffer.pos+1];
|
||||
/* copy odd pixel */
|
||||
work_buffer_dst[count + 2] = dev->oe_buffer.buffer[dev->cur + dev->skip + dev->dist + dev->oe_buffer.pos];
|
||||
work_buffer_dst[count + 3] = dev->oe_buffer.buffer[dev->cur + dev->skip + dev->dist + dev->oe_buffer.pos+1];
|
||||
/* update counter and pointer */
|
||||
count += 4;
|
||||
dev->cur+=2;
|
||||
}
|
||||
}
|
||||
|
||||
/* go to next line if needed */
|
||||
if (dev->cur == dev->len)
|
||||
{
|
||||
dev->oe_buffer.pos += dev->bpl;
|
||||
dev->cur = 0;
|
||||
}
|
||||
|
||||
/* read a new buffer if needed */
|
||||
if (dev->oe_buffer.pos >= dev->oe_buffer.avail)
|
||||
{
|
||||
status = accurate_line_read(dev,dev->oe_buffer.buffer,dev->oe_buffer.size);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (DBG_error,
|
||||
"%s: failed to read %lu bytes (%s)\n", __FUNCTION__,
|
||||
(u_long) dev->oe_buffer.size, sane_strstatus (status));
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
/** @brief fill buffer while reducing vertical resolution
|
||||
* This function fills a read buffer with scanned data from a sensor
|
||||
|
|
|
@ -358,8 +358,9 @@ static void
|
|||
gl847_setup_sensor (Genesys_Device * dev, Genesys_Register_Set * regs, int dpi)
|
||||
{
|
||||
Genesys_Register_Set *r;
|
||||
int i;
|
||||
int dpihw;
|
||||
Sensor_Profile *sensor;
|
||||
int dpihw, i;
|
||||
uint16_t exp;
|
||||
|
||||
DBGSTART;
|
||||
dpihw=sanei_genesys_compute_dpihw(dev,dpi);
|
||||
|
@ -378,6 +379,33 @@ gl847_setup_sensor (Genesys_Device * dev, Genesys_Register_Set * regs, int dpi)
|
|||
r->value = dev->sensor.regs_0x52_0x5e[i];
|
||||
}
|
||||
|
||||
/* set EXPDUMMY and CKxMAP */
|
||||
dpihw=sanei_genesys_compute_dpihw(dev,dpi);
|
||||
sensor=get_sensor_profile(dev->model->ccd_type, dpihw);
|
||||
|
||||
sanei_genesys_set_reg_from_set(regs,REG_EXPDMY,(uint8_t)((sensor->expdummy) & 0xff));
|
||||
|
||||
/* if no calibration has been done, set default values for exposures */
|
||||
sanei_genesys_get_double(dev->reg,REG_EXPR,&exp);
|
||||
if(exp==0)
|
||||
{
|
||||
sanei_genesys_set_double(dev->reg,REG_EXPR,sensor->expr);
|
||||
}
|
||||
sanei_genesys_get_double(dev->reg,REG_EXPG,&exp);
|
||||
if(exp==0)
|
||||
{
|
||||
sanei_genesys_set_double(dev->reg,REG_EXPG,sensor->expg);
|
||||
}
|
||||
sanei_genesys_get_double(dev->reg,REG_EXPB,&exp);
|
||||
if(exp==0)
|
||||
{
|
||||
sanei_genesys_set_double(dev->reg,REG_EXPB,sensor->expb);
|
||||
}
|
||||
|
||||
sanei_genesys_set_triple(regs,REG_CK1MAP,sensor->ck1map);
|
||||
sanei_genesys_set_triple(regs,REG_CK3MAP,sensor->ck3map);
|
||||
sanei_genesys_set_triple(regs,REG_CK4MAP,sensor->ck4map);
|
||||
|
||||
DBGCOMPLETED;
|
||||
}
|
||||
|
||||
|
@ -713,35 +741,6 @@ gl847_init_motor_regs_off (Genesys_Device * dev,
|
|||
|
||||
feedl = 2;
|
||||
|
||||
/* all needed slopes available. we did even decide which mode to use.
|
||||
what next?
|
||||
- transfer slopes
|
||||
SCAN:
|
||||
flags \ use_fast_fed ! 0 1
|
||||
------------------------\--------------------
|
||||
0 ! 0,1,2 0,1,2,3
|
||||
MOTOR_FLAG_AUTO_GO_HOME ! 0,1,2,4 0,1,2,3,4
|
||||
OFF: none
|
||||
FEED: 3
|
||||
GO_HOME: 3
|
||||
HOME_FREE: 3
|
||||
- setup registers
|
||||
* slope specific registers (already done)
|
||||
* DECSEL for HOME_FREE/GO_HOME/SCAN
|
||||
* FEEDL
|
||||
* MTRREV
|
||||
* MTRPWR
|
||||
* FASTFED
|
||||
* STEPSEL
|
||||
* MTRPWM
|
||||
* FSTPSEL
|
||||
* FASTPWM
|
||||
* HOMENEG
|
||||
* BWDSTEP
|
||||
* FWDSTEP
|
||||
* Z1
|
||||
* Z2
|
||||
*/
|
||||
r = sanei_genesys_get_address (reg, 0x3d);
|
||||
r->value = (feedl >> 16) & 0xf;
|
||||
r = sanei_genesys_get_address (reg, 0x3e);
|
||||
|
@ -792,7 +791,6 @@ HOME_FREE: 3
|
|||
r = sanei_genesys_get_address (reg, 0x5f);
|
||||
r->value = 1;
|
||||
|
||||
|
||||
DBGCOMPLETED;
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
|
|
@ -311,6 +311,14 @@
|
|||
#define REGA7 0xa7
|
||||
#define REGA9 0xa9
|
||||
|
||||
#define REG_EXPR 0x10
|
||||
#define REG_EXPG 0x12
|
||||
#define REG_EXPB 0x14
|
||||
#define REG_EXPDMY 0x34
|
||||
#define REG_CK1MAP 0x74
|
||||
#define REG_CK3MAP 0x77
|
||||
#define REG_CK4MAP 0x7a
|
||||
|
||||
#define SCAN_FLAG_SINGLE_LINE 0x01
|
||||
#define SCAN_FLAG_DISABLE_SHADING 0x02
|
||||
#define SCAN_FLAG_DISABLE_GAMMA 0x04
|
||||
|
@ -520,7 +528,6 @@ typedef struct {
|
|||
int ck3map; /**> CK3MAP */
|
||||
int ck4map; /**> CK4MAP */
|
||||
int segcnt; /**> SEGCNT */
|
||||
int tg0cnt; /**> TG0CNT */
|
||||
int expdummy; /**> exposure dummy */
|
||||
int expr; /**> initial red exposure */
|
||||
int expg; /**> initial green exposure */
|
||||
|
@ -536,9 +543,9 @@ static Sensor_Profile sensors[]={
|
|||
{CIS_CANONLIDE200, 150, 2848, 240, 636, 340, 5144, 0, 255, 637, 637, 637},
|
||||
{CIS_CANONLIDE200, 300, 1424, 240, 636, 340, 5144, 0, 255, 637, 637, 637},
|
||||
*/
|
||||
{CIS_CANONLIDE200, 600, 1432, 240, 636, 340, 5144, 0, 255, 410, 275, 203},
|
||||
{CIS_CANONLIDE200, 1200, 2712, 240, 636, 340, 5144, 0, 255, 746, 478, 353},
|
||||
{CIS_CANONLIDE200, 2400, 5280, 240, 636, 340, 5144, 0, 255, 1417, 909, 643},
|
||||
{CIS_CANONLIDE200, 4800, 10416, 240, 636, 340, 5144, 0, 255, 2692, 1728, 1221},
|
||||
{CIS_CANONLIDE200, 600, 1432, 240, 636, 340, 5144, 255, 410, 275, 203},
|
||||
{CIS_CANONLIDE200, 1200, 2712, 240, 636, 340, 5144, 255, 746, 478, 353},
|
||||
{CIS_CANONLIDE200, 2400, 5280, 240, 636, 340, 5144, 255, 1417, 909, 643},
|
||||
{CIS_CANONLIDE200, 4800, 10416, 240, 636, 340, 5144, 255, 2692, 1728, 1221},
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
|
|
@ -1126,23 +1126,19 @@ sanei_genesys_wait_for_home (Genesys_Device * dev)
|
|||
int sanei_genesys_compute_dpihw(Genesys_Device *dev, int xres)
|
||||
{
|
||||
/* can't be below 600 dpi */
|
||||
if(xres<=600)
|
||||
if (xres <= 600)
|
||||
{
|
||||
return 600;
|
||||
}
|
||||
switch(dev->model->ccd_type)
|
||||
if (xres <= dev->sensor.optical_res / 4)
|
||||
{
|
||||
default:
|
||||
if(xres<=dev->sensor.optical_res/4)
|
||||
{
|
||||
return dev->sensor.optical_res/4;
|
||||
}
|
||||
if(xres<=dev->sensor.optical_res/2)
|
||||
{
|
||||
return dev->sensor.optical_res/2;
|
||||
}
|
||||
return dev->sensor.optical_res;
|
||||
return dev->sensor.optical_res / 4;
|
||||
}
|
||||
if (xres <= dev->sensor.optical_res / 2)
|
||||
{
|
||||
return dev->sensor.optical_res / 2;
|
||||
}
|
||||
return dev->sensor.optical_res;
|
||||
}
|
||||
|
||||
/* vim: set sw=2 cino=>2se-1sn-1s{s^-1st0(0u0 smarttab expandtab: */
|
||||
|
|
Ładowanie…
Reference in New Issue