kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Don't enable gamma when not needed
rodzic
9ee689c6f6
commit
1ac04c6266
|
@ -825,12 +825,10 @@ static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
|
||||
sanei_genesys_set_dpihw(*reg, sensor, dpihw);
|
||||
|
||||
// enable gamma tables
|
||||
r = sanei_genesys_get_address (reg, REG_0x05);
|
||||
if (session.params.flags & SCAN_FLAG_DISABLE_GAMMA) {
|
||||
r->value &= ~REG_0x05_GMMENB;
|
||||
if (should_enable_gamma(session, sensor)) {
|
||||
reg->find_reg(REG_0x05).value |= REG_0x05_GMMENB;
|
||||
} else {
|
||||
r->value |= REG_0x05_GMMENB;
|
||||
reg->find_reg(REG_0x05).value &= ~REG_0x05_GMMENB;
|
||||
}
|
||||
|
||||
unsigned dpiset_reg = session.output_resolution * ccd_pixels_per_system_pixel *
|
||||
|
|
|
@ -1504,11 +1504,10 @@ static void gl841_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
}
|
||||
|
||||
// enable gamma tables
|
||||
r = sanei_genesys_get_address (reg, 0x05);
|
||||
if (session.params.flags & SCAN_FLAG_DISABLE_GAMMA) {
|
||||
r->value &= ~REG_0x05_GMMENB;
|
||||
if (should_enable_gamma(session, sensor)) {
|
||||
reg->find_reg(REG_0x05).value |= REG_0x05_GMMENB;
|
||||
} else {
|
||||
r->value |= REG_0x05_GMMENB;
|
||||
reg->find_reg(REG_0x05).value &= ~REG_0x05_GMMENB;
|
||||
}
|
||||
|
||||
/* sensor parameters */
|
||||
|
|
|
@ -79,6 +79,7 @@
|
|||
|
||||
#define REG_0x04S_AFEMOD 4
|
||||
|
||||
#define REG_0x05 0x05
|
||||
#define REG_0x05_DPIHW 0xc0
|
||||
#define REG_0x05_DPIHW_600 0x00
|
||||
#define REG_0x05_DPIHW_1200 0x40
|
||||
|
|
|
@ -1158,12 +1158,10 @@ static void gl843_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
|
||||
sanei_genesys_set_dpihw(*reg, sensor, dpihw);
|
||||
|
||||
// enable gamma tables
|
||||
r = sanei_genesys_get_address(reg, REG_0x05);
|
||||
if (session.params.flags & SCAN_FLAG_DISABLE_GAMMA) {
|
||||
r->value &= ~REG_0x05_GMMENB;
|
||||
if (should_enable_gamma(session, sensor)) {
|
||||
reg->find_reg(REG_0x05).value |= REG_0x05_GMMENB;
|
||||
} else {
|
||||
r->value |= REG_0x05_GMMENB;
|
||||
reg->find_reg(REG_0x05).value &= ~REG_0x05_GMMENB;
|
||||
}
|
||||
|
||||
unsigned dpiset = session.output_resolution * session.ccd_size_divisor *
|
||||
|
|
|
@ -698,12 +698,10 @@ static void gl846_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
|
||||
sanei_genesys_set_dpihw(*reg, sensor, dpihw);
|
||||
|
||||
// enable gamma tables
|
||||
r = sanei_genesys_get_address (reg, REG_0x05);
|
||||
if (session.params.flags & SCAN_FLAG_DISABLE_GAMMA) {
|
||||
r->value &= ~REG_0x05_GMMENB;
|
||||
if (should_enable_gamma(session, sensor)) {
|
||||
reg->find_reg(REG_0x05).value |= REG_0x05_GMMENB;
|
||||
} else {
|
||||
r->value |= REG_0x05_GMMENB;
|
||||
reg->find_reg(REG_0x05).value &= ~REG_0x05_GMMENB;
|
||||
}
|
||||
|
||||
/* CIS scanners can do true gray by setting LEDADD */
|
||||
|
|
|
@ -709,12 +709,10 @@ static void gl847_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
|
||||
sanei_genesys_set_dpihw(*reg, sensor, dpihw);
|
||||
|
||||
// enable gamma tables
|
||||
r = sanei_genesys_get_address (reg, REG_0x05);
|
||||
if (session.params.flags & SCAN_FLAG_DISABLE_GAMMA) {
|
||||
r->value &= ~REG_0x05_GMMENB;
|
||||
if (should_enable_gamma(session, sensor)) {
|
||||
reg->find_reg(REG_0x05).value |= REG_0x05_GMMENB;
|
||||
} else {
|
||||
r->value |= REG_0x05_GMMENB;
|
||||
reg->find_reg(REG_0x05).value &= ~REG_0x05_GMMENB;
|
||||
}
|
||||
|
||||
/* CIS scanners can do true gray by setting LEDADD */
|
||||
|
|
|
@ -972,6 +972,20 @@ void sanei_genesys_set_motor_power(Genesys_Register_Set& regs, bool set)
|
|||
}
|
||||
}
|
||||
|
||||
bool should_enable_gamma(const ScanSession& session, const Genesys_Sensor& sensor)
|
||||
{
|
||||
if (session.params.flags & SCAN_FLAG_DISABLE_GAMMA) {
|
||||
return false;
|
||||
}
|
||||
if (sensor.gamma[0] == 1.0f || sensor.gamma[1] == 1.0f || sensor.gamma[2] == 1.0f) {
|
||||
return false;
|
||||
}
|
||||
if (session.params.depth == 16)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write to many registers at once
|
||||
* Note: sequential call to write register, no effective
|
||||
|
|
|
@ -336,6 +336,8 @@ void sanei_genesys_set_lamp_power(Genesys_Device* dev, const Genesys_Sensor& sen
|
|||
|
||||
void sanei_genesys_set_motor_power(Genesys_Register_Set& regs, bool set);
|
||||
|
||||
bool should_enable_gamma(const ScanSession& session, const Genesys_Sensor& sensor);
|
||||
|
||||
/** Calculates the values of the Z{1,2}MOD registers. They are a phase correction to synchronize
|
||||
with the line clock during acceleration and deceleration.
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue