kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Put the backend code into a separate namespace
rodzic
e32a45fef8
commit
68e5f8a912
|
@ -45,6 +45,8 @@
|
|||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
void Genesys_Buffer::alloc(std::size_t size)
|
||||
{
|
||||
buffer_.resize(size);
|
||||
|
@ -96,3 +98,5 @@ void Genesys_Buffer::consume(std::size_t size)
|
|||
avail_ -= size;
|
||||
pos_ += size;
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
/* A FIFO buffer. Note, that this is _not_ a ringbuffer.
|
||||
if we need a block which does not fit at the end of our available data,
|
||||
we move the available data to the beginning.
|
||||
|
@ -82,4 +84,6 @@ private:
|
|||
std::size_t avail_ = 0;
|
||||
};
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif // BACKEND_GENESYS_BUFFER_H
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
#include "settings.h"
|
||||
#include <ctime>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
struct Genesys_Calibration_Cache
|
||||
{
|
||||
Genesys_Calibration_Cache() = default;
|
||||
|
@ -104,4 +106,6 @@ void serialize(Stream& str, Genesys_Calibration_Cache& x)
|
|||
serialize(str, x.dark_average_data);
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif // BACKEND_GENESYS_CALIBRATION_H
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
#include "device.h"
|
||||
#include <cstdint>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
class Genesys_Device;
|
||||
|
||||
/** Scanner command set description.
|
||||
|
@ -161,5 +163,6 @@ public:
|
|||
virtual void asic_boot(Genesys_Device* dev, bool cold) const = 0;
|
||||
};
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif // BACKEND_GENESYS_COMMAND_SET_H
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
#include "conv.h"
|
||||
#include "sane/sanei_magic.h"
|
||||
|
||||
namespace genesys {
|
||||
|
||||
/**
|
||||
* uses the threshold/threshold_curve to control software binarization
|
||||
* This code was taken from the epjistsu backend by m. allan noah
|
||||
|
@ -232,3 +234,5 @@ void genesys_derotate(Genesys_Scanner* s)
|
|||
// update counters to new image size
|
||||
s->dev->total_bytes_to_read = s->params.bytes_per_line * s->params.lines;
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
#include "sensor.h"
|
||||
#include "genesys.h"
|
||||
|
||||
namespace genesys {
|
||||
|
||||
void binarize_line(Genesys_Device* dev, std::uint8_t* src, std::uint8_t* dst, int width);
|
||||
|
||||
void genesys_gray_lineart(Genesys_Device* dev,
|
||||
|
@ -62,4 +64,6 @@ void genesys_despeck(Genesys_Scanner* s);
|
|||
|
||||
void genesys_derotate(Genesys_Scanner* s);
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif // BACKEND_GENESYS_CONV_H
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
#include "command_set.h"
|
||||
#include "low.h"
|
||||
|
||||
namespace genesys {
|
||||
|
||||
Genesys_Device::~Genesys_Device()
|
||||
{
|
||||
clear();
|
||||
|
@ -110,3 +112,5 @@ void apply_reg_settings_to_device(Genesys_Device& dev, const GenesysRegisterSett
|
|||
dev.write_register(reg.address, val);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -56,6 +56,8 @@
|
|||
#include "sanei.h"
|
||||
#include <vector>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
struct Genesys_Gpo
|
||||
{
|
||||
Genesys_Gpo() = default;
|
||||
|
@ -371,4 +373,6 @@ private:
|
|||
|
||||
void apply_reg_settings_to_device(Genesys_Device& dev, const GenesysRegisterSettingSet& regs);
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
#include <iostream>
|
||||
#include "serialize.h"
|
||||
|
||||
namespace genesys {
|
||||
|
||||
enum class ScanMethod : unsigned {
|
||||
// normal scan method
|
||||
FLATBED = 0,
|
||||
|
@ -359,4 +361,6 @@ enum class AsicType : unsigned
|
|||
GL124,
|
||||
};
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif // BACKEND_GENESYS_ENUMS_H
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
#include "error.h"
|
||||
#include <cstdarg>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
extern "C" void sanei_debug_msg(int level, int max_level, const char *be, const char *fmt,
|
||||
std::va_list ap);
|
||||
|
||||
|
@ -174,3 +176,5 @@ void DebugMessageHelper::vstatus(const char* format, ...)
|
|||
std::vsnprintf(msg_, MAX_BUF_SIZE, format, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -64,6 +64,8 @@
|
|||
#define DBG_io2 7 /* io functions that are called very often */
|
||||
#define DBG_data 8 /* log image data */
|
||||
|
||||
namespace genesys {
|
||||
|
||||
class SaneException : std::exception {
|
||||
public:
|
||||
SaneException(SANE_Status status);
|
||||
|
@ -172,4 +174,6 @@ inline void wrap_status_code_to_exception(SANE_Status status)
|
|||
throw SaneException(status);
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif // BACKEND_GENESYS_ERROR_H
|
||||
|
|
|
@ -75,6 +75,8 @@
|
|||
#include <exception>
|
||||
#include <vector>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
// Data that we allocate to back SANE_Device objects in s_sane_devices
|
||||
struct SANE_Device_Data
|
||||
{
|
||||
|
@ -4721,7 +4723,7 @@ sane_exit_impl(void)
|
|||
run_functions_at_backend_exit();
|
||||
}
|
||||
|
||||
void sane_exit()
|
||||
extern "C" void sane_exit()
|
||||
{
|
||||
catch_all_exceptions(__func__, [](){ sane_exit_impl(); });
|
||||
}
|
||||
|
@ -4768,7 +4770,7 @@ sane_get_devices_impl(const SANE_Device *** device_list, SANE_Bool local_only)
|
|||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
SANE_Status sane_get_devices(const SANE_Device *** device_list, SANE_Bool local_only)
|
||||
extern "C" SANE_Status sane_get_devices(const SANE_Device *** device_list, SANE_Bool local_only)
|
||||
{
|
||||
return wrap_exceptions_to_status_code(__func__, [=]()
|
||||
{
|
||||
|
@ -4879,7 +4881,7 @@ sane_open_impl(SANE_String_Const devicename, SANE_Handle * handle)
|
|||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
SANE_Status sane_open(SANE_String_Const devicename, SANE_Handle* handle)
|
||||
extern "C" SANE_Status sane_open(SANE_String_Const devicename, SANE_Handle* handle)
|
||||
{
|
||||
return wrap_exceptions_to_status_code(__func__, [=]()
|
||||
{
|
||||
|
@ -4954,7 +4956,7 @@ sane_close_impl(SANE_Handle handle)
|
|||
s_scanners->erase(it);
|
||||
}
|
||||
|
||||
void sane_close(SANE_Handle handle)
|
||||
extern "C" void sane_close(SANE_Handle handle)
|
||||
{
|
||||
catch_all_exceptions(__func__, [=]()
|
||||
{
|
||||
|
@ -4976,7 +4978,7 @@ sane_get_option_descriptor_impl(SANE_Handle handle, SANE_Int option)
|
|||
}
|
||||
|
||||
|
||||
const SANE_Option_Descriptor *
|
||||
extern "C" const SANE_Option_Descriptor*
|
||||
sane_get_option_descriptor(SANE_Handle handle, SANE_Int option)
|
||||
{
|
||||
const SANE_Option_Descriptor* ret = nullptr;
|
||||
|
@ -5661,8 +5663,8 @@ sane_control_option_impl(SANE_Handle handle, SANE_Int option,
|
|||
return status;
|
||||
}
|
||||
|
||||
SANE_Status sane_control_option(SANE_Handle handle, SANE_Int option,
|
||||
SANE_Action action, void *val, SANE_Int * info)
|
||||
extern "C" SANE_Status sane_control_option(SANE_Handle handle, SANE_Int option,
|
||||
SANE_Action action, void *val, SANE_Int * info)
|
||||
{
|
||||
return wrap_exceptions_to_status_code(__func__, [=]()
|
||||
{
|
||||
|
@ -5698,7 +5700,7 @@ SANE_Status sane_get_parameters_impl(SANE_Handle handle, SANE_Parameters* params
|
|||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
SANE_Status sane_get_parameters(SANE_Handle handle, SANE_Parameters* params)
|
||||
extern "C" SANE_Status sane_get_parameters(SANE_Handle handle, SANE_Parameters* params)
|
||||
{
|
||||
return wrap_exceptions_to_status_code(__func__, [=]()
|
||||
{
|
||||
|
@ -5786,7 +5788,7 @@ SANE_Status sane_start_impl(SANE_Handle handle)
|
|||
return status;
|
||||
}
|
||||
|
||||
SANE_Status sane_start(SANE_Handle handle)
|
||||
extern "C" SANE_Status sane_start(SANE_Handle handle)
|
||||
{
|
||||
return wrap_exceptions_to_status_code(__func__, [=]()
|
||||
{
|
||||
|
@ -5918,7 +5920,7 @@ sane_read_impl(SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, SANE_Int*
|
|||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
SANE_Status sane_read(SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, SANE_Int* len)
|
||||
extern "C" SANE_Status sane_read(SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, SANE_Int* len)
|
||||
{
|
||||
return wrap_exceptions_to_status_code(__func__, [=]()
|
||||
{
|
||||
|
@ -5962,7 +5964,7 @@ void sane_cancel_impl(SANE_Handle handle)
|
|||
return;
|
||||
}
|
||||
|
||||
void sane_cancel(SANE_Handle handle)
|
||||
extern "C" void sane_cancel(SANE_Handle handle)
|
||||
{
|
||||
catch_all_exceptions(__func__, [=]() { sane_cancel_impl(handle); });
|
||||
}
|
||||
|
@ -5984,8 +5986,7 @@ sane_set_io_mode_impl(SANE_Handle handle, SANE_Bool non_blocking)
|
|||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
sane_set_io_mode(SANE_Handle handle, SANE_Bool non_blocking)
|
||||
extern "C" SANE_Status sane_set_io_mode(SANE_Handle handle, SANE_Bool non_blocking)
|
||||
{
|
||||
return wrap_exceptions_to_status_code(__func__, [=]()
|
||||
{
|
||||
|
@ -6007,8 +6008,7 @@ sane_get_select_fd_impl(SANE_Handle handle, SANE_Int * fd)
|
|||
return SANE_STATUS_UNSUPPORTED;
|
||||
}
|
||||
|
||||
SANE_Status
|
||||
sane_get_select_fd(SANE_Handle handle, SANE_Int * fd)
|
||||
extern "C" SANE_Status sane_get_select_fd(SANE_Handle handle, SANE_Int* fd)
|
||||
{
|
||||
return wrap_exceptions_to_status_code(__func__, [=]()
|
||||
{
|
||||
|
@ -6030,3 +6030,5 @@ GenesysButtonName genesys_option_to_button(int option)
|
|||
default: throw std::runtime_error("Unknown option to convert to button index");
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -82,6 +82,8 @@
|
|||
#define SANE_I18N(text) text
|
||||
#endif
|
||||
|
||||
namespace genesys {
|
||||
|
||||
/** List of SANE options
|
||||
*/
|
||||
enum Genesys_Option
|
||||
|
@ -246,4 +248,6 @@ void write_calibration(std::ostream& str, Genesys_Device::Calibration& cache);
|
|||
bool read_calibration(std::istream& str, Genesys_Device::Calibration& cache,
|
||||
const std::string& path);
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif /* not GENESYS_H */
|
||||
|
|
|
@ -49,6 +49,8 @@
|
|||
|
||||
#include <vector>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
bool CommandSetGl124::get_gain4_bit(Genesys_Register_Set* regs) const
|
||||
{
|
||||
return static_cast<bool>(regs->get8(REG06) & REG06_GAIN4);
|
||||
|
@ -2624,3 +2626,5 @@ std::unique_ptr<CommandSet> create_gl124_cmd_set()
|
|||
{
|
||||
return std::unique_ptr<CommandSet>(new CommandSetGl124{});
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -49,6 +49,8 @@
|
|||
|
||||
#define SETREG(adr,val) { dev->reg.init_reg(adr, val); }
|
||||
|
||||
namespace genesys {
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t r31;
|
||||
|
@ -201,4 +203,6 @@ public:
|
|||
void asic_boot(Genesys_Device* dev, bool cold) const override;
|
||||
};
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif // BACKEND_GENESYS_GL124_H
|
||||
|
|
|
@ -55,6 +55,8 @@
|
|||
|
||||
#include <vector>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
/**
|
||||
* reads value from gpio endpoint
|
||||
*/
|
||||
|
@ -3669,3 +3671,5 @@ std::unique_ptr<CommandSet> create_gl646_cmd_set()
|
|||
{
|
||||
return std::unique_ptr<CommandSet>(new CommandSetGl646{});
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -50,6 +50,8 @@
|
|||
#include "genesys.h"
|
||||
#include "command_set.h"
|
||||
|
||||
namespace genesys {
|
||||
|
||||
static void gl646_set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint8_t set, int dpi);
|
||||
|
||||
/**
|
||||
|
@ -318,4 +320,6 @@ public:
|
|||
void asic_boot(Genesys_Device* dev, bool cold) const override;
|
||||
};
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif // BACKEND_GENESYS_GL646_H
|
||||
|
|
|
@ -57,6 +57,8 @@
|
|||
|
||||
#include <vector>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
// Set address for writing data
|
||||
static void gl841_set_buffer_address_gamma(Genesys_Device* dev, uint32_t addr)
|
||||
{
|
||||
|
@ -4256,3 +4258,5 @@ std::unique_ptr<CommandSet> create_gl841_cmd_set()
|
|||
{
|
||||
return std::unique_ptr<CommandSet>(new CommandSetGl841{});
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -49,6 +49,8 @@
|
|||
|
||||
#define INITREG(adr,val) {dev->reg.init_reg(adr, val); }
|
||||
|
||||
namespace genesys {
|
||||
|
||||
/**
|
||||
* prototypes declaration in case of unit testing
|
||||
*/
|
||||
|
@ -142,4 +144,6 @@ public:
|
|||
void asic_boot(Genesys_Device* dev, bool cold) const override;
|
||||
};
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif // BACKEND_GENESYS_GL841_H
|
||||
|
|
|
@ -50,6 +50,8 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
// Set address for writing data
|
||||
static void gl843_set_buffer_address(Genesys_Device* dev, uint32_t addr)
|
||||
{
|
||||
|
@ -3490,3 +3492,5 @@ std::unique_ptr<CommandSet> create_gl843_cmd_set()
|
|||
{
|
||||
return std::unique_ptr<CommandSet>(new CommandSetGl843{});
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -62,6 +62,8 @@
|
|||
|
||||
#define SETREG(adr,val) { dev->reg.init_reg(adr, val); }
|
||||
|
||||
namespace genesys {
|
||||
|
||||
class CommandSetGl843 : public CommandSet
|
||||
{
|
||||
public:
|
||||
|
@ -144,4 +146,6 @@ public:
|
|||
void asic_boot(Genesys_Device* dev, bool cold) const override;
|
||||
};
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif // BACKEND_GENESYS_GL843_H
|
||||
|
|
|
@ -54,6 +54,8 @@
|
|||
|
||||
#include <vector>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
bool CommandSetGl846::get_gain4_bit(Genesys_Register_Set* regs) const
|
||||
{
|
||||
GenesysRegister *r = sanei_genesys_get_address(regs, 0x06);
|
||||
|
@ -2439,3 +2441,5 @@ std::unique_ptr<CommandSet> create_gl846_cmd_set()
|
|||
{
|
||||
return std::unique_ptr<CommandSet>(new CommandSetGl846{});
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
#ifndef BACKEND_GENESYS_GL846_H
|
||||
#define BACKEND_GENESYS_GL846_H
|
||||
|
||||
namespace genesys {
|
||||
|
||||
/** @brief moves the slider to steps at motor base dpi
|
||||
* @param dev device to work on
|
||||
* @param steps number of steps to move
|
||||
|
@ -214,4 +216,6 @@ public:
|
|||
void asic_boot(Genesys_Device* dev, bool cold) const override;
|
||||
};
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif // BACKEND_GENESYS_GL846_H
|
||||
|
|
|
@ -49,6 +49,8 @@
|
|||
|
||||
#include <vector>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
bool CommandSetGl847::get_gain4_bit(Genesys_Register_Set* regs) const
|
||||
{
|
||||
GenesysRegister *r = sanei_genesys_get_address(regs, 0x06);
|
||||
|
@ -2519,3 +2521,5 @@ std::unique_ptr<CommandSet> create_gl847_cmd_set()
|
|||
{
|
||||
return std::unique_ptr<CommandSet>(new CommandSetGl847{});
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
#include "genesys.h"
|
||||
#include "command_set.h"
|
||||
|
||||
namespace genesys {
|
||||
|
||||
/** @brief moves the slider to steps at motor base dpi
|
||||
* @param dev device to work on
|
||||
* @param steps number of steps to move
|
||||
|
@ -198,4 +200,6 @@ public:
|
|||
void asic_boot(Genesys_Device* dev, bool cold) const override;
|
||||
};
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif // BACKEND_GENESYS_GL847_H
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
|
||||
#include <array>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
Image::Image() = default;
|
||||
|
||||
Image::Image(std::size_t width, std::size_t height, PixelFormat format) :
|
||||
|
@ -198,3 +200,5 @@ void convert_pixel_row_format(const std::uint8_t* in_data, PixelFormat in_format
|
|||
throw SaneException("Unknown pixel format %d", static_cast<unsigned>(in_format));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
#include "image_pixel.h"
|
||||
#include <vector>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
class Image
|
||||
{
|
||||
public:
|
||||
|
@ -80,4 +82,6 @@ private:
|
|||
void convert_pixel_row_format(const std::uint8_t* in_data, PixelFormat in_format,
|
||||
std::uint8_t* out_data, PixelFormat out_format, std::size_t count);
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif // ifndef BACKEND_GENESYS_IMAGE_H
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
#include "image_buffer.h"
|
||||
#include "image.h"
|
||||
|
||||
namespace genesys {
|
||||
|
||||
ImageBuffer::ImageBuffer(std::size_t size, ProducerCallback producer) :
|
||||
producer_{producer},
|
||||
size_{size},
|
||||
|
@ -197,3 +199,5 @@ std::size_t ImageBufferGenesysUsb::get_read_size()
|
|||
|
||||
return size;
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -49,6 +49,8 @@
|
|||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
// This class allows reading from row-based source in smaller or larger chunks of data
|
||||
class ImageBuffer
|
||||
{
|
||||
|
@ -122,4 +124,6 @@ private:
|
|||
ProducerCallback producer_;
|
||||
};
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif // BACKEND_GENESYS_IMAGE_BUFFER_H
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
#include "low.h"
|
||||
#include <numeric>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
ImagePipelineNode::~ImagePipelineNode() {}
|
||||
|
||||
std::size_t ImagePipelineNodeBytesSource::consume_remaining_bytes(std::size_t bytes)
|
||||
|
@ -832,3 +834,5 @@ Image ImagePipelineStack::get_image()
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -52,6 +52,8 @@
|
|||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
class ImagePipelineNode
|
||||
{
|
||||
public:
|
||||
|
@ -565,5 +567,6 @@ private:
|
|||
std::vector<std::unique_ptr<ImagePipelineNode>> nodes_;
|
||||
};
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif // ifndef BACKEND_GENESYS_IMAGE_PIPELINE_H
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
|
||||
#include <array>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
struct PixelFormatDesc
|
||||
{
|
||||
PixelFormat format;
|
||||
|
@ -503,3 +505,5 @@ template void set_raw_channel_to_row<PixelFormat::RGB161616>(
|
|||
std::uint8_t* data, std::size_t x, unsigned channel, std::uint16_t pixel);
|
||||
template void set_raw_channel_to_row<PixelFormat::BGR161616>(
|
||||
std::uint8_t* data, std::size_t x, unsigned channel, std::uint16_t pixel);
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
enum class PixelFormat
|
||||
{
|
||||
|
@ -138,4 +139,6 @@ template<PixelFormat Format>
|
|||
void set_raw_channel_to_row(std::uint8_t* data, std::size_t x, unsigned channel,
|
||||
std::uint16_t pixel);
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif // BACKEND_GENESYS_IMAGE_PIXEL_H
|
||||
|
|
|
@ -54,6 +54,8 @@
|
|||
/* functions calling ASIC specific functions */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
namespace genesys {
|
||||
|
||||
/**
|
||||
* setup the hardware dependent functions
|
||||
*/
|
||||
|
@ -2633,3 +2635,5 @@ void debug_dump(unsigned level, const Genesys_Sensor& sensor)
|
|||
DBG(level, " gamma.green : %f\n", sensor.gamma[1]);
|
||||
DBG(level, " gamma.blue : %f\n", sensor.gamma[2]);
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -207,6 +207,8 @@
|
|||
#define MAX_RESOLUTIONS 13
|
||||
#define MAX_DPI 4
|
||||
|
||||
namespace genesys {
|
||||
|
||||
/* Forward typedefs */
|
||||
struct Genesys_Scanner;
|
||||
typedef struct Genesys_Calibration_Cache Genesys_Calibration_Cache;
|
||||
|
@ -635,4 +637,6 @@ void debug_dump(unsigned level, const Genesys_Register_Set& regs);
|
|||
void debug_dump(unsigned level, const GenesysRegisterSettingSet& regs);
|
||||
void debug_dump(unsigned level, const Genesys_Sensor& sensor);
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif /* not GENESYS_LOW_H */
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
#include <vector>
|
||||
#include "enums.h"
|
||||
|
||||
namespace genesys {
|
||||
|
||||
struct Genesys_Motor_Slope
|
||||
{
|
||||
Genesys_Motor_Slope() = default;
|
||||
|
@ -99,4 +101,6 @@ struct Genesys_Motor
|
|||
std::vector<Genesys_Motor_Slope> slopes;
|
||||
};
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif // BACKEND_GENESYS_MOTOR_H
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
struct GenesysRegister
|
||||
{
|
||||
std::uint16_t address = 0;
|
||||
|
@ -402,4 +404,6 @@ void apply_registers_ordered(const RegisterSettingSet<Value>& set,
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif // BACKEND_GENESYS_REGISTER_H
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
#include <cstddef>
|
||||
#include <vector>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
class RowBuffer
|
||||
{
|
||||
public:
|
||||
|
@ -207,4 +209,6 @@ private:
|
|||
std::vector<std::uint8_t> data_;
|
||||
};
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif // BACKEND_GENESYS_LINE_BUFFER_H
|
||||
|
|
|
@ -45,6 +45,8 @@
|
|||
|
||||
#include "sanei.h"
|
||||
|
||||
namespace genesys {
|
||||
|
||||
UsbDevice::~UsbDevice()
|
||||
{
|
||||
if (is_open()) {
|
||||
|
@ -139,3 +141,5 @@ void UsbDevice::set_not_open()
|
|||
is_open_ = false;
|
||||
name_ = "";
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -50,6 +50,8 @@
|
|||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
class UsbDevice {
|
||||
public:
|
||||
UsbDevice() = default;
|
||||
|
@ -94,4 +96,6 @@ private:
|
|||
int device_num_ = 0;
|
||||
};
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif // BACKEND_GENESYS_SANEI_H
|
||||
|
|
|
@ -50,6 +50,8 @@
|
|||
#include <array>
|
||||
#include <functional>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
template<class T, size_t Size>
|
||||
struct AssignableArray : public std::array<T, Size> {
|
||||
AssignableArray() = default;
|
||||
|
@ -424,4 +426,6 @@ void serialize(Stream& str, Genesys_Sensor& x)
|
|||
serialize(str, x.sensor_profiles);
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif // BACKEND_GENESYS_SENSOR_H
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
// it would be best to use something like boost.serialization
|
||||
|
||||
inline void serialize_newline(std::ostream& str) { str << '\n'; }
|
||||
|
@ -143,4 +145,6 @@ void serialize(std::istream& str, std::array<T, Size>& x)
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
#include "enums.h"
|
||||
#include "serialize.h"
|
||||
|
||||
namespace genesys {
|
||||
|
||||
struct Genesys_Settings
|
||||
{
|
||||
ScanMethod scan_method = ScanMethod::FLATBED;
|
||||
|
@ -346,4 +348,6 @@ void serialize(Stream& str, Genesys_Current_Setup& x)
|
|||
serialize(str, x.max_shift);
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif // BACKEND_GENESYS_SETTINGS_H
|
||||
|
|
|
@ -45,6 +45,8 @@
|
|||
|
||||
#include "low.h"
|
||||
|
||||
namespace genesys {
|
||||
|
||||
StaticInit<std::vector<Genesys_Frontend>> s_frontends;
|
||||
|
||||
void genesys_init_frontend_tables()
|
||||
|
@ -625,3 +627,5 @@ void genesys_init_frontend_tables()
|
|||
fe.reg2 = {0x00, 0x00, 0x00};
|
||||
s_frontends->push_back(fe);
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -45,6 +45,8 @@
|
|||
|
||||
#include "low.h"
|
||||
|
||||
namespace genesys {
|
||||
|
||||
StaticInit<std::vector<Genesys_Gpo>> s_gpo;
|
||||
|
||||
void genesys_init_gpo_tables()
|
||||
|
@ -409,3 +411,5 @@ void genesys_init_gpo_tables()
|
|||
};
|
||||
s_gpo->push_back(gpo);
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -56,6 +56,8 @@
|
|||
|
||||
#include "low.h"
|
||||
|
||||
namespace genesys {
|
||||
|
||||
StaticInit<std::vector<Genesys_USB_Device_Entry>> s_usb_devices;
|
||||
|
||||
void genesys_init_usb_device_tables()
|
||||
|
@ -2673,3 +2675,5 @@ void genesys_init_usb_device_tables()
|
|||
|
||||
s_usb_devices->emplace_back(0x1083, 0x162e, model);
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -45,6 +45,8 @@
|
|||
|
||||
#include "low.h"
|
||||
|
||||
namespace genesys {
|
||||
|
||||
StaticInit<std::vector<Genesys_Motor>> s_motors;
|
||||
|
||||
void genesys_init_motor_tables()
|
||||
|
@ -696,3 +698,5 @@ void genesys_init_motor_tables()
|
|||
|
||||
s_motors->push_back(std::move(motor));
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -45,6 +45,8 @@
|
|||
|
||||
#include "low.h"
|
||||
|
||||
namespace genesys {
|
||||
|
||||
// This file contains reference motor slope tables.
|
||||
// The tables are directly extracted from USB logs, with a termination value of 0
|
||||
|
||||
|
@ -1211,3 +1213,5 @@ Motor_Profile gl124_motor_profiles[] = {
|
|||
|
||||
{ MotorId::UNKNOWN, 0, StepType::FULL, nullptr },
|
||||
};
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -45,6 +45,8 @@
|
|||
|
||||
#include "low.h"
|
||||
|
||||
namespace genesys {
|
||||
|
||||
inline unsigned default_get_logical_hwdpi(const Genesys_Sensor& sensor, unsigned xres)
|
||||
{
|
||||
if (sensor.logical_dpihw_override)
|
||||
|
@ -3721,3 +3723,5 @@ void genesys_init_sensor_tables()
|
|||
sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi;
|
||||
s_sensors->push_back(sensor);
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -27,9 +27,9 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
test_calibration_parsing();
|
||||
test_image();
|
||||
test_image_pipeline();
|
||||
test_row_buffer();
|
||||
genesys::test_calibration_parsing();
|
||||
genesys::test_image();
|
||||
genesys::test_image_pipeline();
|
||||
genesys::test_row_buffer();
|
||||
return finish_tests();
|
||||
}
|
||||
|
|
|
@ -23,9 +23,13 @@
|
|||
#ifndef SANE_TESTSUITE_BACKEND_GENESYS_GENESYS_UNIT_TEST_H
|
||||
#define SANE_TESTSUITE_BACKEND_GENESYS_GENESYS_UNIT_TEST_H
|
||||
|
||||
namespace genesys {
|
||||
|
||||
void test_calibration_parsing();
|
||||
void test_image();
|
||||
void test_image_pipeline();
|
||||
void test_row_buffer();
|
||||
|
||||
} // namespace genesys
|
||||
|
||||
#endif
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
|
||||
#include <sstream>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
Genesys_Calibration_Cache create_fake_calibration_entry()
|
||||
{
|
||||
Genesys_Calibration_Cache calib;
|
||||
|
@ -133,3 +135,5 @@ void test_calibration_parsing()
|
|||
{
|
||||
test_calibration_roundtrip();
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include "../../../backend/genesys/image_pipeline.h"
|
||||
#include <vector>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
void test_get_pixel_from_row()
|
||||
{
|
||||
std::vector<std::uint8_t> data = {
|
||||
|
@ -570,3 +572,5 @@ void test_image()
|
|||
test_set_raw_channel_to_row();
|
||||
test_convert_pixel_row_format();
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
|
||||
#include <numeric>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
void test_image_buffer_genesys_usb()
|
||||
{
|
||||
std::vector<std::size_t> requests;
|
||||
|
@ -513,3 +515,5 @@ void test_image_pipeline()
|
|||
test_node_calibrate_8bit();
|
||||
test_node_calibrate_16bit();
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
|
@ -39,19 +39,19 @@ std::ostream& operator<<(std::ostream& str, const std::vector<T>& arg)
|
|||
return str;
|
||||
}
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& str, const PixelFormat& arg)
|
||||
inline std::ostream& operator<<(std::ostream& str, const genesys::PixelFormat& arg)
|
||||
{
|
||||
str << static_cast<unsigned>(arg);
|
||||
return str;
|
||||
}
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& str, const Pixel& arg)
|
||||
inline std::ostream& operator<<(std::ostream& str, const genesys::Pixel& arg)
|
||||
{
|
||||
str << "{ " << arg.r << ", " << arg.g << ", " << arg.b << " }";
|
||||
return str;
|
||||
}
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& str, const RawPixel& arg)
|
||||
inline std::ostream& operator<<(std::ostream& str, const genesys::RawPixel& arg)
|
||||
{
|
||||
auto flags = str.flags();
|
||||
str << std::hex;
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
|
||||
#include <numeric>
|
||||
|
||||
namespace genesys {
|
||||
|
||||
void test_row_buffer_push_pop_forward(unsigned size)
|
||||
{
|
||||
RowBuffer buf{1};
|
||||
|
@ -85,3 +87,5 @@ void test_row_buffer()
|
|||
test_row_buffer_push_pop_backward(size);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace genesys
|
||||
|
|
Ładowanie…
Reference in New Issue