genesys: Add sensor profile to the sensor struct

This will allow moving per-chip sensor profile tables to a common
configuration
merge-requests/134/head
Povilas Kanapickas 2019-08-17 11:02:36 +03:00
rodzic ba546d5370
commit 4348451e47
2 zmienionych plików z 50 dodań i 7 usunięć

Wyświetl plik

@ -5122,7 +5122,7 @@ probe_genesys_devices (void)
of Genesys_Calibration_Cache as is.
*/
static const char* CALIBRATION_IDENT = "sane_genesys";
static const int CALIBRATION_VERSION = 3;
static const int CALIBRATION_VERSION = 4;
bool read_calibration(std::istream& str, Genesys_Device::Calibration& calibration,
const std::string& path)

Wyświetl plik

@ -149,9 +149,49 @@ void serialize(Stream& str, Genesys_Frontend& x)
}
struct SensorExposure {
uint16_t red, green, blue;
uint16_t red = 0;
uint16_t green = 0;
uint16_t blue = 0;
bool operator==(const SensorExposure& other) const
{
return red == other.red && green == other.green && blue == other.blue;
}
};
struct SensorProfile
{
unsigned dpi = 0;
unsigned ccd_size_divisor = 1;
unsigned exposure_lperiod = 0;
SensorExposure exposure;
std::vector<unsigned> segment_order;
GenesysRegisterSettingSet custom_regs;
bool operator==(const SensorProfile& other) const
{
return dpi == other.dpi &&
ccd_size_divisor == other.ccd_size_divisor &&
exposure_lperiod == other.exposure_lperiod &&
exposure == other.exposure &&
segment_order == other.segment_order &&
custom_regs == other.custom_regs;
}
};
template<class Stream>
void serialize(Stream& str, SensorProfile& x)
{
serialize(str, x.dpi);
serialize(str, x.ccd_size_divisor);
serialize(str, x.exposure_lperiod);
serialize(str, x.exposure.red);
serialize(str, x.exposure.green);
serialize(str, x.exposure.blue);
serialize(str, x.segment_order);
serialize(str, x.custom_regs);
}
struct Genesys_Sensor {
Genesys_Sensor() = default;
@ -206,6 +246,8 @@ struct Genesys_Sensor {
// red, green and blue gamma coefficient for default gamma tables
AssignableArray<float, 3> gamma;
std::vector<SensorProfile> sensor_profiles;
std::function<unsigned(const Genesys_Sensor&, unsigned)> get_logical_hwdpi_fun;
std::function<unsigned(const Genesys_Sensor&, unsigned)> get_register_hwdpi_fun;
std::function<unsigned(const Genesys_Sensor&, unsigned)> get_ccd_size_divisor_fun;
@ -244,13 +286,12 @@ struct Genesys_Sensor {
sensor_pixels == other.sensor_pixels &&
fau_gain_white_ref == other.fau_gain_white_ref &&
gain_white_ref == other.gain_white_ref &&
exposure.blue == other.exposure.blue &&
exposure.green == other.exposure.green &&
exposure.red == other.exposure.red &&
exposure == other.exposure &&
exposure_lperiod == other.exposure_lperiod &&
custom_regs == other.custom_regs &&
custom_fe_regs == other.custom_fe_regs &&
gamma == other.gamma;
gamma == other.gamma &&
sensor_profiles == other.sensor_profiles;
}
};
@ -280,6 +321,8 @@ void serialize(Stream& str, Genesys_Sensor& x)
serialize(str, x.custom_fe_regs);
serialize_newline(str);
serialize(str, x.gamma);
serialize_newline(str);
serialize(str, x.sensor_profiles);
}
#endif //
#endif // BACKEND_GENESYS_SENSOR_H