kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Pass OPTICAL_FLAG_ENABLE_LEDADD flag via session
rodzic
7d6897ecb4
commit
a4b551be0c
|
@ -898,7 +898,8 @@ static void gl124_setup_sensor(Genesys_Device * dev,
|
|||
*/
|
||||
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,
|
||||
const ScanSession& session, int used_res,
|
||||
unsigned int start, unsigned int pixels,
|
||||
int channels, int depth, unsigned ccd_size_divisor,
|
||||
ColorFilter color_filter, int flags)
|
||||
{
|
||||
|
@ -1047,9 +1048,8 @@ static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
{
|
||||
r = sanei_genesys_get_address (reg, REG60);
|
||||
r->value &= ~REG60_LEDADD;
|
||||
if (channels == 1 && (flags & OPTICAL_FLAG_ENABLE_LEDADD))
|
||||
{
|
||||
r->value |= REG60_LEDADD;
|
||||
if (session.enable_ledadd) {
|
||||
r->value |= REG60_LEDADD;
|
||||
expmax = reg->get24(REG_EXPR);
|
||||
expmax = std::max(expmax, reg->get24(REG_EXPG));
|
||||
expmax = std::max(expmax, reg->get24(REG_EXPB));
|
||||
|
@ -1057,17 +1057,16 @@ static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
dev->reg.set24(REG_EXPR, expmax);
|
||||
dev->reg.set24(REG_EXPG, expmax);
|
||||
dev->reg.set24(REG_EXPB, expmax);
|
||||
}
|
||||
}
|
||||
/* RGB weighting, REG_TRUER,G and B are to be set */
|
||||
r = sanei_genesys_get_address (reg, 0x01);
|
||||
r->value &= ~REG01_TRUEGRAY;
|
||||
if (channels == 1 && (flags & OPTICAL_FLAG_ENABLE_LEDADD))
|
||||
{
|
||||
r->value |= REG01_TRUEGRAY;
|
||||
if (session.enable_ledadd) {
|
||||
r->value |= REG01_TRUEGRAY;
|
||||
dev->write_register(REG_TRUER, 0x80);
|
||||
dev->write_register(REG_TRUEG, 0x80);
|
||||
dev->write_register(REG_TRUEB, 0x80);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* segment number */
|
||||
|
@ -1135,8 +1134,9 @@ static void gl124_compute_session(Genesys_Device* dev, ScanSession& s,
|
|||
{
|
||||
DBG_HELPER(dbg);
|
||||
(void) sensor;
|
||||
(void) dev;
|
||||
s.params.assert_valid();
|
||||
|
||||
s.enable_ledadd = (s.params.channels == 1 && dev->model->is_cis && dev->settings.true_gray);
|
||||
s.computed = true;
|
||||
}
|
||||
|
||||
|
@ -1258,15 +1258,10 @@ static void gl124_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
oflags |= OPTICAL_FLAG_DISABLE_LAMP;
|
||||
}
|
||||
|
||||
if (dev->model->is_cis && dev->settings.true_gray)
|
||||
{
|
||||
oflags |= OPTICAL_FLAG_ENABLE_LEDADD;
|
||||
}
|
||||
|
||||
// now _LOGICAL_ optical values used are known, setup registers
|
||||
gl124_init_optical_regs_scan(dev, sensor, reg, exposure_time, used_res, start, used_pixels,
|
||||
session.params.channels, session.params.depth, ccd_size_divisor,
|
||||
session.params.color_filter, oflags);
|
||||
gl124_init_optical_regs_scan(dev, sensor, reg, exposure_time, session, used_res, start,
|
||||
used_pixels, session.params.channels, session.params.depth,
|
||||
ccd_size_divisor, session.params.color_filter, oflags);
|
||||
|
||||
/*** motor parameters ***/
|
||||
|
||||
|
|
|
@ -1465,7 +1465,8 @@ static void gl841_init_optical_regs_off(Genesys_Register_Set* reg)
|
|||
|
||||
static void gl841_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sensor& sensor,
|
||||
Genesys_Register_Set* reg, unsigned int exposure_time,
|
||||
unsigned int used_res, unsigned int start,
|
||||
const ScanSession& session, unsigned int used_res,
|
||||
unsigned int start,
|
||||
unsigned int pixels, int channels,
|
||||
int depth, unsigned ccd_size_divisor,
|
||||
ColorFilter color_filter, int flags)
|
||||
|
@ -1560,10 +1561,9 @@ static void gl841_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
/* AFEMOD should depend on FESET, and we should set these
|
||||
* bits separately */
|
||||
r->value &= ~(REG04_FILTER | REG04_AFEMOD);
|
||||
if (flags & OPTICAL_FLAG_ENABLE_LEDADD)
|
||||
{
|
||||
r->value |= 0x10; /* no filter */
|
||||
}
|
||||
if (session.params.flags & SCAN_FLAG_ENABLE_LEDADD) {
|
||||
r->value |= 0x10; /* no filter */
|
||||
}
|
||||
else if (channels == 1)
|
||||
{
|
||||
switch (color_filter)
|
||||
|
@ -1597,8 +1597,7 @@ static void gl841_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
/* CIS scanners can do true gray by setting LEDADD */
|
||||
r = sanei_genesys_get_address (reg, 0x87);
|
||||
r->value &= ~REG87_LEDADD;
|
||||
if (flags & OPTICAL_FLAG_ENABLE_LEDADD)
|
||||
{
|
||||
if (session.params.flags & SCAN_FLAG_ENABLE_LEDADD) {
|
||||
r->value |= REG87_LEDADD;
|
||||
expr = reg->get16(REG_EXPR);
|
||||
expg = reg->get16(REG_EXPG);
|
||||
|
@ -1966,13 +1965,10 @@ dummy \ scanned lines
|
|||
if (session.params.flags & SCAN_FLAG_DISABLE_LAMP) {
|
||||
oflags |= OPTICAL_FLAG_DISABLE_LAMP;
|
||||
}
|
||||
if (session.params.flags & SCAN_FLAG_ENABLE_LEDADD) {
|
||||
oflags |= OPTICAL_FLAG_ENABLE_LEDADD;
|
||||
}
|
||||
|
||||
gl841_init_optical_regs_scan(dev, sensor, reg, exposure_time, used_res, start, used_pixels,
|
||||
session.params.channels, session.params.depth, ccd_size_divisor,
|
||||
session.params.color_filter, oflags);
|
||||
gl841_init_optical_regs_scan(dev, sensor, reg, exposure_time, session, used_res, start,
|
||||
used_pixels, session.params.channels, session.params.depth,
|
||||
ccd_size_divisor, session.params.color_filter, oflags);
|
||||
|
||||
/*** motor parameters ***/
|
||||
|
||||
|
|
|
@ -774,7 +774,8 @@ 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,
|
||||
const ScanSession& session, int used_res,
|
||||
unsigned int start, unsigned int pixels,
|
||||
int channels, int depth,
|
||||
ColorFilter color_filter, int flags)
|
||||
{
|
||||
|
@ -932,14 +933,13 @@ static void gl846_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
{
|
||||
r = sanei_genesys_get_address (reg, 0x87);
|
||||
r->value &= ~REG87_LEDADD;
|
||||
if (channels == 1 && (flags & OPTICAL_FLAG_ENABLE_LEDADD))
|
||||
{
|
||||
r->value |= REG87_LEDADD;
|
||||
if (session.enable_ledadd) {
|
||||
r->value |= REG87_LEDADD;
|
||||
}
|
||||
/* RGB weighting
|
||||
r = sanei_genesys_get_address (reg, 0x01);
|
||||
r->value &= ~REG01_TRUEGRAY;
|
||||
if (channels == 1 && (flags & OPTICAL_FLAG_ENABLE_LEDADD))
|
||||
if (session.enable_ledadd))
|
||||
{
|
||||
r->value |= REG01_TRUEGRAY;
|
||||
}*/
|
||||
|
@ -1004,8 +1004,10 @@ static void gl846_compute_session(Genesys_Device* dev, ScanSession& s,
|
|||
{
|
||||
DBG_HELPER(dbg);
|
||||
(void) sensor;
|
||||
(void) dev;
|
||||
s.params.assert_valid();
|
||||
|
||||
s.enable_ledadd = (s.params.channels == 1 && dev->model->is_cis && dev->settings.true_gray);
|
||||
|
||||
s.computed = true;
|
||||
}
|
||||
|
||||
|
@ -1118,15 +1120,9 @@ static void gl846_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
if (session.params.flags & SCAN_FLAG_DISABLE_LAMP) {
|
||||
oflags |= OPTICAL_FLAG_DISABLE_LAMP;
|
||||
}
|
||||
if (dev->model->is_cis && dev->settings.true_gray)
|
||||
{
|
||||
oflags |= OPTICAL_FLAG_ENABLE_LEDADD;
|
||||
}
|
||||
|
||||
gl846_init_optical_regs_scan(dev, sensor, reg, exposure_time, used_res, start, used_pixels,
|
||||
session.params.channels, session.params.depth,
|
||||
session.params.color_filter,
|
||||
oflags);
|
||||
gl846_init_optical_regs_scan(dev, sensor, reg, exposure_time, session, used_res, start,
|
||||
used_pixels, session.params.channels, session.params.depth,
|
||||
session.params.color_filter, oflags);
|
||||
|
||||
/*** motor parameters ***/
|
||||
|
||||
|
|
|
@ -791,7 +791,8 @@ 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,
|
||||
const ScanSession& session, int used_res,
|
||||
unsigned int start, unsigned int pixels,
|
||||
int channels, int depth,
|
||||
ColorFilter color_filter, int flags)
|
||||
{
|
||||
|
@ -950,16 +951,14 @@ static void gl847_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
{
|
||||
r = sanei_genesys_get_address (reg, 0x87);
|
||||
r->value &= ~REG87_LEDADD;
|
||||
if (channels == 1 && (flags & OPTICAL_FLAG_ENABLE_LEDADD))
|
||||
{
|
||||
r->value |= REG87_LEDADD;
|
||||
}
|
||||
if (session.enable_ledadd) {
|
||||
r->value |= REG87_LEDADD;
|
||||
}
|
||||
/* RGB weighting
|
||||
r = sanei_genesys_get_address (reg, 0x01);
|
||||
r->value &= ~REG01_TRUEGRAY;
|
||||
if (channels == 1 && (flags & OPTICAL_FLAG_ENABLE_LEDADD))
|
||||
{
|
||||
r->value |= REG01_TRUEGRAY;
|
||||
if (session.enable_ledadd) {
|
||||
r->value |= REG01_TRUEGRAY;
|
||||
}*/
|
||||
}
|
||||
|
||||
|
@ -1137,13 +1136,8 @@ static void gl847_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
oflags |= OPTICAL_FLAG_DISABLE_LAMP;
|
||||
}
|
||||
|
||||
if (dev->model->is_cis && dev->settings.true_gray)
|
||||
{
|
||||
oflags |= OPTICAL_FLAG_ENABLE_LEDADD;
|
||||
}
|
||||
|
||||
gl847_init_optical_regs_scan(dev, sensor, reg, exposure_time, used_res, start, used_pixels,
|
||||
session.params.channels, session.params.depth,
|
||||
gl847_init_optical_regs_scan(dev, sensor, reg, exposure_time, session, used_res, start,
|
||||
used_pixels, session.params.channels, session.params.depth,
|
||||
session.params.color_filter, oflags);
|
||||
|
||||
/*** motor parameters ***/
|
||||
|
|
|
@ -384,7 +384,6 @@ typedef struct {
|
|||
#define OPTICAL_FLAG_DISABLE_GAMMA 0x01 /**< disable gamma correction */
|
||||
#define OPTICAL_FLAG_DISABLE_SHADING 0x02 /**< disable shading correction */
|
||||
#define OPTICAL_FLAG_DISABLE_LAMP 0x04 /**< turn off lamp */
|
||||
#define OPTICAL_FLAG_ENABLE_LEDADD 0x08 /**< enable true CIS gray by enabling LED addition */
|
||||
#define OPTICAL_FLAG_STAGGER 0x20 /**< disable stagger correction */
|
||||
#define OPTICAL_FLAG_USE_XPA 0x40 /**< use XPA lamp rather than regular one */
|
||||
|
||||
|
|
|
@ -224,6 +224,9 @@ struct ScanSession {
|
|||
// different color channels
|
||||
unsigned max_color_shift_lines = 0;
|
||||
|
||||
// whether to enable ledadd functionality
|
||||
bool enable_ledadd = false;
|
||||
|
||||
void assert_computed() const
|
||||
{
|
||||
if (!computed) {
|
||||
|
|
Ładowanie…
Reference in New Issue