kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Add a way to configure per-sensor stagger config
rodzic
e0d669acfe
commit
4c0f63052b
|
@ -4715,7 +4715,7 @@ static void probe_genesys_devices()
|
|||
of Genesys_Calibration_Cache as is.
|
||||
*/
|
||||
static const char* CALIBRATION_IDENT = "sane_genesys";
|
||||
static const int CALIBRATION_VERSION = 20;
|
||||
static const int CALIBRATION_VERSION = 21;
|
||||
|
||||
bool read_calibration(std::istream& str, Genesys_Device::Calibration& calibration,
|
||||
const std::string& path)
|
||||
|
|
|
@ -49,6 +49,15 @@
|
|||
|
||||
namespace genesys {
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const StaggerConfig& config)
|
||||
{
|
||||
out << "StaggerConfig{\n"
|
||||
<< " min_resolution: " << config.min_resolution() << '\n'
|
||||
<< " lines_at_min: " << config.lines_at_min() << '\n'
|
||||
<< "}";
|
||||
return out;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const FrontendType& type)
|
||||
{
|
||||
switch (type) {
|
||||
|
@ -137,6 +146,7 @@ std::ostream& operator<<(std::ostream& out, const Genesys_Sensor& sensor)
|
|||
<< " segment_size: " << sensor.segment_size << '\n'
|
||||
<< " segment_order: "
|
||||
<< format_indent_braced_list(4, format_vector_unsigned(4, sensor.segment_order)) << '\n'
|
||||
<< " stagger_config: " << format_indent_braced_list(4, sensor.stagger_config) << '\n'
|
||||
<< " custom_base_regs: " << format_indent_braced_list(4, sensor.custom_base_regs) << '\n'
|
||||
<< " custom_regs: " << format_indent_braced_list(4, sensor.custom_regs) << '\n'
|
||||
<< " custom_fe_regs: " << format_indent_braced_list(4, sensor.custom_fe_regs) << '\n'
|
||||
|
|
|
@ -67,6 +67,51 @@ struct AssignableArray : public std::array<T, Size> {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
class StaggerConfig
|
||||
{
|
||||
public:
|
||||
StaggerConfig() = default;
|
||||
StaggerConfig(unsigned min_resolution, unsigned lines_at_min) :
|
||||
min_resolution_{min_resolution},
|
||||
lines_at_min_{lines_at_min}
|
||||
{
|
||||
}
|
||||
|
||||
unsigned stagger_at_resolution(unsigned xresolution, unsigned yresolution) const
|
||||
{
|
||||
if (min_resolution_ == 0 || xresolution < min_resolution_)
|
||||
return 0;
|
||||
return yresolution / min_resolution_ * lines_at_min_;
|
||||
}
|
||||
|
||||
unsigned min_resolution() const { return min_resolution_; }
|
||||
unsigned lines_at_min() const { return lines_at_min_; }
|
||||
|
||||
bool operator==(const StaggerConfig& other) const
|
||||
{
|
||||
return min_resolution_ == other.min_resolution_ &&
|
||||
lines_at_min_ == other.lines_at_min_;
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned min_resolution_ = 0;
|
||||
unsigned lines_at_min_ = 0;
|
||||
|
||||
template<class Stream>
|
||||
friend void serialize(Stream& str, StaggerConfig& x);
|
||||
};
|
||||
|
||||
template<class Stream>
|
||||
void serialize(Stream& str, StaggerConfig& x)
|
||||
{
|
||||
serialize(str, x.min_resolution_);
|
||||
serialize(str, x.lines_at_min_);
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const StaggerConfig& config);
|
||||
|
||||
|
||||
enum class FrontendType : unsigned
|
||||
{
|
||||
UNKNOWN,
|
||||
|
@ -310,6 +355,10 @@ struct Genesys_Sensor {
|
|||
// only on gl843
|
||||
std::vector<unsigned> segment_order;
|
||||
|
||||
// some CCDs use two arrays of pixels for double resolution. On such CCDs when scanning at
|
||||
// high-enough resolution, every other pixel column is shifted
|
||||
StaggerConfig stagger_config;
|
||||
|
||||
GenesysRegisterSettingSet custom_base_regs; // gl646-specific
|
||||
GenesysRegisterSettingSet custom_regs;
|
||||
GenesysRegisterSettingSet custom_fe_regs;
|
||||
|
@ -370,6 +419,7 @@ struct Genesys_Sensor {
|
|||
exposure_lperiod == other.exposure_lperiod &&
|
||||
segment_size == other.segment_size &&
|
||||
segment_order == other.segment_order &&
|
||||
stagger_config == other.stagger_config &&
|
||||
custom_base_regs == other.custom_base_regs &&
|
||||
custom_regs == other.custom_regs &&
|
||||
custom_fe_regs == other.custom_fe_regs &&
|
||||
|
@ -401,6 +451,8 @@ void serialize(Stream& str, Genesys_Sensor& x)
|
|||
serialize_newline(str);
|
||||
serialize(str, x.segment_order);
|
||||
serialize_newline(str);
|
||||
serialize(str, x.stagger_config);
|
||||
serialize_newline(str);
|
||||
serialize(str, x.custom_base_regs);
|
||||
serialize_newline(str);
|
||||
serialize(str, x.custom_regs);
|
||||
|
|
Ładowanie…
Reference in New Issue