Projects
domecam:swift
domecam
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 23
View file
domecam.changes
Changed
@@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Tue Sep 20 10:32:56 UTC 2022 - Matwey V. Kornilov <matwey@sai.msu.ru> + +- Version 0.1.8 + +------------------------------------------------------------------- Fri May 6 13:55:33 UTC 2022 - Matwey V. Kornilov <matwey@sai.msu.ru> - Version 0.1.7
View file
_service
Changed
@@ -3,7 +3,7 @@ <param name="url">http://curl.sai.msu.ru/hg/home/matwey/domecam/</param> <param name="scm">hg</param> <param name="versionformat">{latesttag}</param> - <param name="revision">0.1.7</param> + <param name="revision">0.1.8</param> </service> <service name="tar" mode="buildtime" /> <service name="recompress" mode="buildtime">
View file
domecam-0.1.7.obscpio/.hgignore -> domecam-0.1.8.obscpio/.hgignore
Changed
@@ -1,3 +1,3 @@ syntax: regexp -^build/ +^build ^tags$
View file
domecam-0.1.7.obscpio/.hgtags -> domecam-0.1.8.obscpio/.hgtags
Changed
@@ -5,3 +5,4 @@ bed3c493a6fd64ba8f0929b8ad56ab51144628f6 0.1.4 8e510d8d9774e21cdbf83dd82d7b029285889ae4 0.1.5 3f19208b6ac21b2b2776f064440fb20d5f99170b 0.1.6 +41a20f4ebd5e57689dc34e2b7f56e18609dadf14 0.1.7
View file
domecam-0.1.7.obscpio/CMakeLists.txt -> domecam-0.1.8.obscpio/CMakeLists.txt
Changed
@@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 3.5) -project(domecam LANGUAGES C CXX VERSION 0.1.7) +project(domecam LANGUAGES C CXX VERSION 0.1.8) -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) include(GNUInstallDirs)
View file
domecam-0.1.7.obscpio/exe/carriage.cpp -> domecam-0.1.8.obscpio/exe/carriage.cpp
Changed
@@ -7,11 +7,10 @@ #include <atomic> #include <iomanip> #include <iostream> +#include <optional> #include <string> #include <thread> -#include <boost/optional.hpp> - #include <application.h> #include <carriage.h> #include <executor.h> @@ -60,7 +59,6 @@ explicit carriage_mask_executor(std::uint16_t mask); virtual executor_result run(abstract_carriage& c) const override; - virtual ~carriage_mask_executor() override = default; private: std::uint16_t mask_; }; @@ -79,7 +77,6 @@ explicit carriage_data_executor(std::uint16_t data); virtual executor_result run(abstract_carriage& c) const override; - virtual ~carriage_data_executor() override = default; private: std::uint16_t data_; }; @@ -98,7 +95,6 @@ explicit carriage_axis_executor(std::uint16_t axis); virtual executor_result run(abstract_carriage& c) const override; - virtual ~carriage_axis_executor() override = default; private: std::uint16_t axis_; }; @@ -117,7 +113,6 @@ explicit carriage_speed_executor(std::uint16_t speed); virtual executor_result run(abstract_carriage& c) const override; - virtual ~carriage_speed_executor() override = default; private: std::uint16_t speed_; }; @@ -166,7 +161,7 @@ int application::do_run(const boost::program_options::variables_map& va, abstract_carriage& c) { if (va.count(home_opt)) { - carriage_home_executor executor_(boost::none); + carriage_home_executor executor_(std::nullopt); executor_.run(c); } else if (va.count(mask_opt)) { carriage_mask_executor executor_(va[mask_opt].as<std::uint16_t>()); @@ -178,10 +173,10 @@ carriage_axis_executor executor_(va[axis_opt].as<std::uint16_t>()); executor_.run(c); } else if (va.count(run_opt)) { - carriage_run_executor executor_(boost::none, va[run_opt].as<std::int16_t>()); + carriage_run_executor executor_(std::nullopt, va[run_opt].as<std::int16_t>()); executor_.run(c); } else if (va.count(track_opt)) { - carriage_track_executor executor_(boost::none, carriage::direction::cw); + carriage_track_executor executor_(std::nullopt, carriage::direction::cw); executor_.run(c); } else if (va.count(speed_opt)) { carriage_speed_executor executor_(va[speed_opt].as<std::uint16_t>());
View file
domecam-0.1.7.obscpio/exe/domecam-replay.cpp -> domecam-0.1.8.obscpio/exe/domecam-replay.cpp
Changed
@@ -26,11 +26,15 @@ static constexpr const char binary_filename_opt[] = "binary_filename"; static constexpr const char pupil_mask_filename_opt[] = "pupil_mask_filename"; static constexpr const char mean_pupil_mask_filename_opt[] = "mean_pupil_mask_filename"; + static constexpr const char clean_filename_opt[] = "clean_filename"; + static constexpr const char normalized_clean_filename_opt[] = "normalized_clean_filename"; static constexpr const char pupil_opt[] = "pupil"; static constexpr const char pupil_samples_opt[] = "samples"; static constexpr const char force_initial_opt[] = "force_initial"; static constexpr const char edge_opt[] = "edge"; static constexpr const char edge_loss_factor_opt[] = "loss_factor"; + static constexpr const char bias_filename_opt[] = "bias_filename"; + static constexpr const char mask_filename_opt[] = "mask_filename"; }; constexpr const char application::input_filename_opt[]; @@ -39,11 +43,15 @@ constexpr const char application::binary_filename_opt[]; constexpr const char application::pupil_mask_filename_opt[]; constexpr const char application::mean_pupil_mask_filename_opt[]; +constexpr const char application::clean_filename_opt[]; +constexpr const char application::normalized_clean_filename_opt[]; constexpr const char application::pupil_opt[]; constexpr const char application::pupil_samples_opt[]; constexpr const char application::force_initial_opt[]; constexpr const char application::edge_opt[]; constexpr const char application::edge_loss_factor_opt[]; +constexpr const char application::bias_filename_opt[]; +constexpr const char application::mask_filename_opt[]; application::application(): abstract_application() { namespace po = boost::program_options; @@ -55,11 +63,15 @@ (binary_filename_opt, po::value<std::string>(), "Binary output filename") (pupil_mask_filename_opt, po::value<std::string>(), "Pupil mask output filename") (mean_pupil_mask_filename_opt, po::value<std::string>(), "Mean pupil mask output filename") + (clean_filename_opt, po::value<std::string>(), "Clean output filename") + (normalized_clean_filename_opt, po::value<std::string>(), "Normalized clean output filename") (pupil_opt, "Do entrance pupil image processing") (pupil_samples_opt, po::value<std::size_t>()->default_value(60), "Number of pupil edge sampling points") (force_initial_opt, "Force initial geometry reestimation for each frame") (edge_opt, "Do entrance pupil edge processing") (edge_loss_factor_opt, po::value<float>(), "Step range for the focus position estimation") + (bias_filename_opt, po::value<std::string>(), "CCD Bias filename") + (mask_filename_opt, po::value<std::string>(), "Pupil binary mask filename") ; pos_opts_.add(input_filename_opt, -1); @@ -105,6 +117,19 @@ const auto& loss_factor = va[edge_loss_factor_opt].as<float>(); edge_replay_executor e(va[pupil_samples_opt].as<std::size_t>(), va.count(force_initial_opt) > 0, loss_factor); std::cerr << e.run(vi); + } else if (va.count(clean_filename_opt) || va.count(normalized_clean_filename_opt)) { + const auto& bias_filename = va[bias_filename_opt].as<std::string>(); + const auto& mask_filename = va[mask_filename_opt].as<std::string>(); + + if (va.count(clean_filename_opt)) { + const auto& output_filename = va[clean_filename_opt].as<std::string>(); + clean_replay_executor e(output_filename, bias_filename, mask_filename); + std::cerr << e.run(vi); + } else if (va.count(normalized_clean_filename_opt)) { + const auto& output_filename = va[normalized_clean_filename_opt].as<std::string>(); + normalized_clean_replay_executor e(output_filename, bias_filename, mask_filename); + std::cerr << e.run(vi); + } } const auto time_end = std::chrono::steady_clock::now();
View file
domecam-0.1.7.obscpio/exe/domecam.cpp -> domecam-0.1.8.obscpio/exe/domecam.cpp
Changed
@@ -61,7 +61,7 @@ const auto b = ctx.camera_.binning(); std::cout << "Binning: x: " << std::get<0>(b) << ", y: " << std::get<1>(b) << std::endl; } - std::cout << "Pixel Format: " << ctx.camera_.pixel_format() << std::endl; + std::cout << "Pixel Format: " << ctx.camera_.pixel_format_as_string() << std::endl; { const auto r = ctx.camera_.region(); std::cout << "Format: " << std::get<0>(r.size) << " x " << std::get<1>(r.size);
View file
domecam-0.1.7.obscpio/exe/domecamd/consumer.cpp -> domecam-0.1.8.obscpio/exe/domecamd/consumer.cpp
Changed
@@ -10,8 +10,7 @@ #include <sstream> #include <stdexcept> #include <string> - -#include <boost/variant/apply_visitor.hpp> +#include <variant> #include <camera_settings.h> #include <error.h> @@ -44,7 +43,7 @@ optional_camera_settings camera_settings_; }; -using domecamd_request = boost::variant<domecamd_request_ping, domecamd_request_schedule>; +using domecamd_request = std::variant<domecamd_request_ping, domecamd_request_schedule>; struct domecamd_response_error { std::exception_ptr reason_; @@ -223,15 +222,13 @@ * Unfortunately, the parsing implementation is very simple currently. * */ - const auto correlation_id = boost::make_optional(message.hasCorrelationID(), message.correlationID()); - const auto reply_to = boost::make_optional(message.hasReplyTo(), message.replyTo()); + const auto correlation_id = message.hasCorrelationID() ? std::make_optional(message.correlationID()) : std::nullopt; + const auto reply_to = message.hasReplyTo() ? std::make_optional(message.replyTo()) : std::nullopt; struct request_visitor { - using result_type = void; - consumer& consumer_; - const boost::optional<std::string>& correlation_id_; - const boost::optional<std::string>& reply_to_; + const std::optional<std::string>& correlation_id_; + const std::optional<std::string>& reply_to_; void operator() (const domecamd_request_ping& r) const { if (reply_to_) { @@ -273,7 +270,7 @@ try { std::istringstream iss{std::string{message.body(), message.bodySize()}}; auto request = load_json<domecamd_request>(iss); - boost::apply_visitor(request_visitor{*this, correlation_id, reply_to}, request); + std::visit(request_visitor{*this, correlation_id, reply_to}, request); } catch (...) { if (reply_to) { reply(domecamd_response_error{std::current_exception()}, *reply_to, correlation_id); @@ -284,11 +281,11 @@ } template<class T> -void consumer::reply(const T& x, const std::string& routing_key, const boost::optional<std::string>& correlation_id, const std::string& exchange) { +void consumer::reply(const T& x, const std::string& routing_key, const std::optional<std::string>& correlation_id, const std::string& exchange) { reply(save_json(x), routing_key, correlation_id, exchange); } -void consumer::reply(const std::string& body, const std::string& routing_key, const boost::optional<std::string>& correlation_id, const std::string& exchange) { +void consumer::reply(const std::string& body, const std::string& routing_key, const std::optional<std::string>& correlation_id, const std::string& exchange) { AMQP::Envelope env{body.data(), body.size()}; if (correlation_id) { env.setCorrelationID(*correlation_id);
View file
domecam-0.1.7.obscpio/exe/domecamd/scheduler.cpp -> domecam-0.1.8.obscpio/exe/domecamd/scheduler.cpp
Changed
@@ -20,7 +20,7 @@ mutex_{} { } -boost::optional<std::string> scheduler::try_schedule(const std::string& id, std::unique_ptr<executor>&& e, const optional_camera_settings& camera_settings) { +std::optional<std::string> scheduler::try_schedule(const std::string& id, std::unique_ptr<executor>&& e, const optional_camera_settings& camera_settings) { const std::lock_guard<std::mutex> guard{mutex_}; const auto shared_active_task = active_task_.lock(); @@ -29,7 +29,7 @@ } schedule(id, std::move(e), camera_settings); - return boost::none; + return std::nullopt; } void scheduler::schedule(const std::string& id, std::unique_ptr<executor>&& e, const optional_camera_settings& camera_settings) {
View file
domecam-0.1.7.obscpio/include/binary.h -> domecam-0.1.8.obscpio/include/binary.h
Changed
@@ -143,11 +143,10 @@ assert(width_ * height_ == b.size()); - for (std::size_t i = 0; i < b.size(); ++i) { - ret.data()[i] = (b.data()[i] < threshold ? - static_cast<result_type>(0) : - static_cast<result_type>(255)); - } + std::transform(b.cbegin(), b.cend(), ret.begin(), [&threshold] (const T& x) { + return x < threshold ? + static_cast<result_type>(0) : static_cast<result_type>(255); + }); return ret; }
View file
domecam-0.1.7.obscpio/include/buffer.h -> domecam-0.1.8.obscpio/include/buffer.h
Changed
@@ -14,6 +14,7 @@ #include <cstring> #include <memory> #include <type_traits> +#include <utility> #include <buffer_view.h> @@ -54,16 +55,12 @@ deleter(const deleter& other) = delete; deleter(deleter&& other) noexcept: allocator_type(std::move(other)), - capacity_(std::move(other.capacity_)) { - - other.capacity_ = 0; + capacity_(std::exchange(other.capacity_, 0)) { } deleter& operator=(const deleter& other) = delete; deleter& operator=(deleter&& other) noexcept { static_cast<allocator_type&>(*this) = std::move(other); - capacity_ = std::move(other.capacity_); - - other.capacity_ = 0; + capacity_ = std::exchange(other.capacity_, 0); return *this; } @@ -128,9 +125,7 @@ } buffer(buffer&& other) noexcept: data_{std::move(other.data_)}, - size_{std::move(other.size_)} { - - other.size_ = 0; + size_{std::exchange(other.size_, 0)} { } template<class Initializer> explicit buffer(Initializer&& izr):
View file
domecam-0.1.7.obscpio/include/buffer_view.h -> domecam-0.1.8.obscpio/include/buffer_view.h
Changed
@@ -26,8 +26,8 @@ constexpr static const std::size_t align = Align; constexpr static const std::size_t packet_size = align / sizeof(T); - struct alignas(Align) packet { - value_type elem[packet_size]; + struct packet { + alignas(Align) value_type elem[packet_size]; }; };
View file
domecam-0.1.7.obscpio/include/camera.h -> domecam-0.1.8.obscpio/include/camera.h
Changed
@@ -42,16 +42,12 @@ inline bool operator==(const region_type& other) const; inline bool operator!=(const region_type& other) const; }; + + typedef std::uint32_t pixel_format_type; public: explicit camera(const char* name); explicit camera(const std::string& name); camera(); - camera(const camera&) = delete; - camera(camera&&) = default; - ~camera() override = default; - - camera& operator=(const camera&) = delete; - camera& operator=(camera&&) = default; const char* device_id(); const char* vendor_id(); @@ -75,9 +71,12 @@ binning_type binning(const binning_type& binning_); binning_type binning(std::int32_t horizontal, std::int32_t vertical); - const char* pixel_format(); + const char* pixel_format_as_string(); const char* pixel_format(const std::string& pixel_format_); + pixel_format_type pixel_format(); + pixel_format_type pixel_format(pixel_format_type pixel_format_); + region_type region(); region_type region(const region_type& region_); region_type region(std::int32_t width, std::int32_t height, std::int32_t x = 0, std::int32_t y = 0);
View file
domecam-0.1.7.obscpio/include/camera_settings.h -> domecam-0.1.8.obscpio/include/camera_settings.h
Changed
@@ -9,10 +9,9 @@ #include <camera.h> +#include <optional> #include <utility> - -#include <boost/optional.hpp> -#include <boost/variant.hpp> +#include <variant> class camera_settings { public: @@ -22,13 +21,10 @@ using binning_type = camera::binning_type; using region_type = camera::region_type; using packet_size_type = std::size_t; + using pixel_format_type = camera::pixel_format_type; - constexpr camera_settings(const binning_type& binning, exposure_time_type exposure_time, frame_rate_type frame_rate, gain_type gain, packet_size_type packet_size, const region_type& region); + constexpr camera_settings(const binning_type& binning, exposure_time_type exposure_time, frame_rate_type frame_rate, gain_type gain, packet_size_type packet_size, const region_type& region, pixel_format_type pixel_format); explicit camera_settings(camera& cam); - camera_settings(const camera_settings&) = default; - camera_settings(camera_settings&&) = default; - camera_settings& operator=(const camera_settings&) = default; - camera_settings& operator=(camera_settings&&) = default; const frame_rate_type& frame_rate() const { return frame_rate_; @@ -53,6 +49,10 @@ const packet_size_type& packet_size() const { return packet_size_; } + + const pixel_format_type& pixel_format() const { + return pixel_format_; + } private: frame_rate_type frame_rate_; gain_type gain_; @@ -60,6 +60,7 @@ binning_type binning_; region_type region_; packet_size_type packet_size_; + pixel_format_type pixel_format_; }; class optional_camera_settings { @@ -70,12 +71,13 @@ using binning_type = camera_settings::binning_type; struct full_tag {}; - using region_type = boost::variant<full_tag, camera_settings::region_type>; + using region_type = std::variant<full_tag, camera_settings::region_type>; struct auto_tag {}; - using packet_size_type = boost::variant<auto_tag, camera_settings::packet_size_type>; + using packet_size_type = std::variant<auto_tag, camera_settings::packet_size_type>; + using pixel_format_type = camera_settings::pixel_format_type; - optional_camera_settings(const boost::optional<binning_type>& binning, boost::optional<exposure_time_type> exposure_time, boost::optional<frame_rate_type> frame_rate, boost::optional<gain_type> gain, boost::optional<packet_size_type> packet_size, const boost::optional<region_type>& region); + optional_camera_settings(const std::optional<binning_type>& binning, std::optional<exposure_time_type> exposure_time, std::optional<frame_rate_type> frame_rate, std::optional<gain_type> gain, std::optional<packet_size_type> packet_size, const std::optional<region_type>& region, const std::optional<pixel_format_type>& pixel_format); optional_camera_settings(const optional_camera_settings&) = default; optional_camera_settings(optional_camera_settings&&) = default; optional_camera_settings(const camera_settings&); @@ -83,26 +85,30 @@ optional_camera_settings& operator=(optional_camera_settings&&) = default; optional_camera_settings& operator=(const camera_settings&); - const boost::optional<gain_type>& gain() const { + const std::optional<gain_type>& gain() const { return gain_; } - const boost::optional<exposure_time_type>& exposure_time() const { + const std::optional<exposure_time_type>& exposure_time() const { return exposure_time_; } - const boost::optional<binning_type>& binning() const { + const std::optional<binning_type>& binning() const { return binning_; } - const boost::optional<region_type>& region() const { + const std::optional<region_type>& region() const { return region_; } - const boost::optional<packet_size_type>& packet_size() const { + const std::optional<packet_size_type>& packet_size() const { return packet_size_; } + const std::optional<pixel_format_type>& pixel_format() const { + return pixel_format_; + } + void apply_to(camera& cam) const; optional_camera_settings& rebase(const camera_settings& base, const camera_settings& target); @@ -112,12 +118,13 @@ void apply_region(camera& cam, const region_type& region) const; void apply_packet_size(camera& cam, const packet_size_type& packet_size) const; private: - boost::optional<frame_rate_type> frame_rate_; - boost::optional<gain_type> gain_; - boost::optional<exposure_time_type> exposure_time_; - boost::optional<binning_type> binning_; - boost::optional<region_type> region_; - boost::optional<packet_size_type> packet_size_; + std::optional<frame_rate_type> frame_rate_; + std::optional<gain_type> gain_; + std::optional<exposure_time_type> exposure_time_; + std::optional<binning_type> binning_; + std::optional<region_type> region_; + std::optional<packet_size_type> packet_size_; + std::optional<pixel_format_type> pixel_format_; }; #endif // _CAMERA_SETTINGS_H
View file
domecam-0.1.8.obscpio/include/clean.h
Added
@@ -0,0 +1,77 @@ +/* + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Copyright (C) 2017-2022 Matwey V. Kornilov <matwey.kornilov@gmail.com> + */ + +#ifndef _CLEAN_H +#define _CLEAN_H + +#include <buffer.h> +#include <buffer_view.h> + +#include <memory> + + +template<class T, std::size_t Align, class Allocator = std::allocator<T>> +class clean: + private Allocator { +public: + using value_type = T; + using result_type = value_type; + using allocator_type = Allocator; + using buffer_type = buffer<result_type, Align, allocator_type>; + using mask_type = std::uint16_t; + +private: + std::size_t width_; + std::size_t height_; + +public: + clean(std::size_t width, std::size_t height, const allocator_type& alloc = allocator_type()): + Allocator(alloc), + width_(width), + height_(height) { + + assert(width_ >= 1); + assert(height_ >= 1); + } + + const std::size_t& width() const { return width_; } + const std::size_t& height() const { return height_; } + + inline buffer_type operator() (buffer_view<value_type, Align> b, buffer_view<value_type> bias, buffer_view<mask_type> mask) const; +}; + +template<class T, std::size_t Align, class Allocator> +typename clean<T, Align, Allocator>::buffer_type +clean<T, Align, Allocator>::operator() (buffer_view<T, Align> b, buffer_view<T> bias, buffer_view<mask_type> mask) const { + constexpr std::size_t mask_capacity = sizeof(mask_type) * 8; + + buffer_type ret{width_ * height_, *this}; + + assert(ret.size() == b.size()); + + auto bias_it = bias.cbegin(); + auto dest_it = ret.begin(); + auto mask_it = mask.cbegin(); + for (auto it = b.cbegin(); it != b.cend(); ++mask_it) { + for (std::size_t bit = 0; + bit < mask_capacity && it != b.cend(); + ++bit, ++it, ++dest_it) { + + *dest_it = (*mask_it & (1 << bit) ? + *it - *bias_it++ : + static_cast<value_type>(0)); + } + } + + assert(bias_it == bias.cend()); + assert(dest_it == ret.end()); + assert(mask_it == mask.cend()); + + return ret; +} + +#endif // _CLEAN_H +
View file
domecam-0.1.7.obscpio/include/element_wise.h -> domecam-0.1.8.obscpio/include/element_wise.h
Changed
@@ -7,6 +7,7 @@ #ifndef _ELEMENT_WISE_H #define _ELEMENT_WISE_H +#include <algorithm> #include <cassert> #include <functional> @@ -32,29 +33,21 @@ inline buffer<result_type, Align, Allocator>& operator() (buffer<first_argument_type, Align, Allocator>& lhs, buffer_view<second_argument_type, Align> rhs) const { static_assert(std::is_same<result_type, first_argument_type>::value, "Only in-place operations are allowed"); - const auto n = lhs.size(); - - assert(lhs.size() == rhs.size()); - - for (std::size_t i = 0; i < n; ++i) { - lhs.data()[i] = Op::operator() (lhs.data()[i], rhs.data()[i]); - } + std::transform(lhs.cbegin(), lhs.cend(), rhs.cbegin(), lhs.begin(), static_cast<const Op&>(*this)); return lhs; - } + } template<class Allocator> inline buffer<result_type, Align, Allocator>& operator() (buffer<first_argument_type, Align, Allocator>& lhs, second_argument_type rhs) const { static_assert(std::is_same<result_type, first_argument_type>::value, "Only in-place operations are allowed"); - const auto n = lhs.size(); + using std::placeholders::_1; - for (std::size_t i = 0; i < n; ++i) { - lhs.data()[i] = Op::operator() (lhs.data()[i], rhs); - } + std::transform(lhs.cbegin(), lhs.cend(), lhs.begin(), std::bind(static_cast<const Op&>(*this), _1, rhs)); return lhs; - } + } }; template<class T, std::size_t Align>
View file
domecam-0.1.7.obscpio/include/error.h -> domecam-0.1.8.obscpio/include/error.h
Changed
@@ -24,6 +24,10 @@ explicit validation_error(const std::string& what); }; +struct aux_image_incorrect_position: public validation_error { + aux_image_incorrect_position(const std::string& source_uri, const std::array<std::size_t, 2>& offset, const std::array<std::size_t, 2>& size); +}; + struct empty_frame: public validation_error { empty_frame(); };
View file
domecam-0.1.7.obscpio/include/exe/domecamd/consumer.h -> domecam-0.1.8.obscpio/include/exe/domecamd/consumer.h
Changed
@@ -8,11 +8,11 @@ #define _EXE_DOMECAMD_CONSUMER_H #include <cstdint> +#include <optional> #include <stdexcept> #include <string> #include <boost/asio/io_service.hpp> -#include <boost/optional.hpp> #include <amqpcpp.h> #include <amqpcpp/libboostasio.h> @@ -32,8 +32,8 @@ void handle_request(const AMQP::Message& message, std::uint64_t deliveryTag); template<class T> - void reply(const T& x, const std::string& routing_key, const boost::optional<std::string>& correlation_id, const std::string& exchange = std::string()); - void reply(const std::string& body, const std::string& routing_key, const boost::optional<std::string>& correlation_id, const std::string& exchange = std::string()); + void reply(const T& x, const std::string& routing_key, const std::optional<std::string>& correlation_id, const std::string& exchange = std::string()); + void reply(const std::string& body, const std::string& routing_key, const std::optional<std::string>& correlation_id, const std::string& exchange = std::string()); void on_channel_ready(); void on_exchange_dlx_success();
View file
domecam-0.1.7.obscpio/include/exe/domecamd/scheduler.h -> domecam-0.1.8.obscpio/include/exe/domecamd/scheduler.h
Changed
@@ -8,12 +8,12 @@ #define _EXE_DOMECAMD_SCHEDULER_H #include <exception> +#include <optional> #include <string> #include <memory> #include <mutex> #include <boost/asio/io_service.hpp> -#include <boost/optional.hpp> #include <camera.h> #include <camera_settings.h> @@ -37,7 +37,7 @@ scheduler(boost::asio::io_context& io_context, camera& c); virtual ~scheduler() = 0; - boost::optional<std::string> try_schedule(const std::string& id, std::unique_ptr<executor>&& e, const optional_camera_settings& camera_settings); + std::optional<std::string> try_schedule(const std::string& id, std::unique_ptr<executor>&& e, const optional_camera_settings& camera_settings); inline boost::asio::io_context& io_context() { return io_context_;
View file
domecam-0.1.7.obscpio/include/executor.h -> domecam-0.1.8.obscpio/include/executor.h
Changed
@@ -9,11 +9,13 @@ #include <executor/binary.h> #include <executor/carriage.h> +#include <executor/clean.h> #include <executor/edge.h> #include <executor/gain.h> #include <executor/grad.h> #include <executor/mean_pupil_mask.h> #include <executor/mean_raw.h> +#include <executor/normalized_clean.h> #include <executor/pupil.h> #include <executor/pupil_mask.h> #include <executor/raw.h>
View file
domecam-0.1.7.obscpio/include/executor/binary.h -> domecam-0.1.8.obscpio/include/executor/binary.h
Changed
@@ -65,7 +65,6 @@ binary_executor(const std::string& target_uri, std::size_t frames_number); virtual executor_result run(camera& c) const override; - virtual ~binary_executor() override = default; }; class binary_replay_executor: @@ -77,7 +76,6 @@ explicit binary_replay_executor(const std::string& target_uri); virtual executor_result run(const fits::variant_image& vi) const override; - virtual ~binary_replay_executor() override = default; }; #endif // _EXECUTOR_BINARY_H
View file
domecam-0.1.7.obscpio/include/executor/carriage.h -> domecam-0.1.8.obscpio/include/executor/carriage.h
Changed
@@ -7,7 +7,7 @@ #ifndef _EXECUTOR_CARRIAGE_H #define _EXECUTOR_CARRIAGE_H -#include <boost/optional.hpp> +#include <optional> #include <executorfwd.h> @@ -15,42 +15,39 @@ class carriage_track_executor: public carriage_executor { private: - const boost::optional<std::uint16_t> axis_; + const std::optional<std::uint16_t> axis_; const abstract_carriage::direction direction_; struct runner; public: - carriage_track_executor(const boost::optional<std::uint16_t>& axis, abstract_carriage::direction d); + carriage_track_executor(const std::optional<std::uint16_t>& axis, abstract_carriage::direction d); virtual executor_result run(abstract_carriage& c) const override; - virtual ~carriage_track_executor() override = default; }; class carriage_run_executor: public carriage_executor { private: - const boost::optional<std::uint16_t> axis_; + const std::optional<std::uint16_t> axis_; const std::int16_t absolute_pos_; struct runner; public: - carriage_run_executor(const boost::optional<std::uint16_t>& axis, std::int16_t absolute_pos); + carriage_run_executor(const std::optional<std::uint16_t>& axis, std::int16_t absolute_pos); virtual executor_result run(abstract_carriage& c) const override; - virtual ~carriage_run_executor() override = default; }; class carriage_home_executor: public carriage_executor { private: - const boost::optional<std::uint16_t> axis_; + const std::optional<std::uint16_t> axis_; struct runner; public: - explicit carriage_home_executor(const boost::optional<std::uint16_t>& axis); + explicit carriage_home_executor(const std::optional<std::uint16_t>& axis); virtual executor_result run(abstract_carriage& c) const override; - virtual ~carriage_home_executor() override = default; }; #endif // _EXECUTOR_CARRIAGE_H
View file
domecam-0.1.8.obscpio/include/executor/clean.h
Added
@@ -0,0 +1,115 @@ +/* + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Copyright (C) 2017-2022 Matwey V. Kornilov <matwey.kornilov@gmail.com> + */ + +#ifndef _EXECUTOR_CLEAN_H +#define _EXECUTOR_CLEAN_H + +#include <executorfwd.h> +#include <executor/fits_sink_mixin.h> +#include <executor/pipeline_mixin.h> +#include <pipeline.h> + + +struct clean_executor_base: + protected fits_sink_mixin, + protected pipeline_mixin { +protected: + template<class SourceMixin> class runner; +private: + class runner_base; +public: + clean_executor_base(const std::string& target_uri, const std::string& bias_source_uri, const std::string& mask_source_uri); +private: + std::string bias_source_uri_; + std::string mask_source_uri_; +}; + +class clean_executor_base::runner_base { +public: + using mask_buffer_type = buffer<std::uint16_t>; + using bias_buffer_type = buffer<float>; + +private: + static std::pair<mask_buffer_type, std::size_t> load_mask_image(const std::string& mask_source_uri, const std::array<std::size_t, 2>& offset, const std::array<std::size_t, 2>& size); + static bias_buffer_type load_bias_image(const std::string& bias_source_uri, const std::array<std::size_t, 2>& offset, const std::array<std::size_t, 2>& size, const mask_buffer_type& mask, std::size_t active_count); + +private: + runner_base(std::pair<mask_buffer_type, std::size_t>&& mask, const std::string& bias_source_uri, const std::array<std::size_t, 2>& offset, const std::array<std::size_t, 2>& size); + +public: + runner_base(const std::string& bias_source_uri, const std::string& mask_source_uri, const std::array<std::size_t, 2>& offset, const std::array<std::size_t, 2>& size); + runner_base(const clean_executor_base& e, const std::array<std::size_t, 2>& offset, const std::array<std::size_t, 2>& size); + + const mask_buffer_type& mask() const { return mask_; } + const bias_buffer_type& bias() const { return bias_; } + +private: + mask_buffer_type mask_; + bias_buffer_type bias_; +}; + +template<class SourceMixin> +class clean_executor_base::runner: + public SourceMixin, + protected pipeline_mixin::runner_mixin< + clean_pipeline<typename SourceMixin::source_type::value_type>>, + protected fits_sink_mixin::runner_mixin< + typename clean_pipeline<typename SourceMixin::source_type::value_type>::result_type::value_type, + clean_pipeline<typename SourceMixin::source_type::value_type>::result_type::align>, + protected clean_executor_base::runner_base { +private: + using source_mixin = SourceMixin; + using source_type = typename source_mixin::source_type; + using pipeline_type = clean_pipeline<typename source_type::value_type>; + +public: + template<class Executor, class... Args> + runner(const Executor& e, Args&&... args): + source_mixin(e, std::forward<Args>(args)...), + pipeline_mixin::runner_mixin<pipeline_type>( + this->source().width(), + this->source().height()), + fits_sink_mixin::runner_mixin< + typename pipeline_type::result_type::value_type, + pipeline_type::result_type::align>(e, this->source()), + runner_base(e, + {this->source().xoffset(), this->source().yoffset()}, + {this->source().width(), this->source().height()}) {} + + void run(); +}; + +template<class SourceMixin> +void clean_executor_base::runner<SourceMixin>::run() { + this->for_each([this] (const typename source_type::result_type& b) { + this->append_frame(this->apply(b, bias(), mask())); + }); + + this->commit(); +} + +class clean_executor: + public camera_executor, + public clean_executor_base { +public: + clean_executor(const std::string& target_uri, std::size_t frames_number, const std::string& bias_source_uri, const std::string& mask_source_uri); + + virtual executor_result run(camera& c) const override; +}; + +class clean_replay_executor: + public replay_executor, + public clean_executor_base { +private: + template<class T> using runner_type = runner<source_mixin<T>>; +public: + clean_replay_executor(const std::string& target_uri, const std::string& bias_source_uri, const std::string& mask_source_uri); + + virtual executor_result run(const fits::variant_image& vi) const override; +}; + +#endif // _EXECUTOR_CLEAN_H +
View file
domecam-0.1.7.obscpio/include/executor/edge.h -> domecam-0.1.8.obscpio/include/executor/edge.h
Changed
@@ -103,7 +103,6 @@ edge_executor(std::size_t frames_number, std::size_t samples, bool force_initial, float loss_factor); virtual executor_result run(camera& c) const override; - virtual ~edge_executor() override = default; }; class edge_scan_executor: @@ -113,7 +112,6 @@ edge_scan_executor(std::size_t frames_number, std::size_t samples, bool force_initial, float loss_factor); virtual executor_result run(camera& c) const override; - virtual ~edge_scan_executor() override = default; }; class edge_replay_executor: @@ -125,7 +123,6 @@ edge_replay_executor(std::size_t samples, bool force_initial, float loss_factor); virtual executor_result run(const fits::variant_image& vi) const override; - virtual ~edge_replay_executor() override = default; }; #endif // _EXECUTOR_EDGE_H
View file
domecam-0.1.7.obscpio/include/executor/fits_sink_mixin.h -> domecam-0.1.8.obscpio/include/executor/fits_sink_mixin.h
Changed
@@ -72,8 +72,9 @@ void append_frame(buffer_view<T, Align> b); void shrink_to_fit() override; + public: - runner_mixin(const fits_sink_mixin& e, std::size_t width, std::size_t height, std::size_t depth); + runner_mixin(const fits_sink_mixin& e, std::size_t width, std::size_t height, std::size_t depth, std::uint32_t xoffset, std::uint32_t yoffset); runner_mixin(const fits_sink_mixin& e, std::size_t width, std::size_t height, std::size_t depth, const camera_source_base& s); runner_mixin(const fits_sink_mixin& e, std::size_t width, std::size_t height, std::size_t depth, const scan_source_base& s); runner_mixin(const fits_sink_mixin& e, std::size_t width, std::size_t height, std::size_t depth, const fits_source_base& s); @@ -101,13 +102,19 @@ } template<class T, std::size_t Align> -fits_sink_mixin::runner_mixin<T, Align>::runner_mixin(const fits_sink_mixin& e, std::size_t width, std::size_t height, std::size_t depth): +fits_sink_mixin::runner_mixin<T, Align>::runner_mixin(const fits_sink_mixin& e, std::size_t width, std::size_t height, std::size_t depth, std::uint32_t xoffset, std::uint32_t yoffset): runner_mixin_base(e, sizeof(T) * width * height * depth + 28800), - image_(get_fits().template create_image<T>(width, height, depth)) {} + image_(get_fits().template create_image<T>(width, height, depth)) { + + /* Key updating after image creation */ + auto& f = get_fits(); + f.update_key("XOFFSET", xoffset); + f.update_key("YOFFSET", yoffset); +} template<class T, std::size_t Align> fits_sink_mixin::runner_mixin<T, Align>::runner_mixin(const fits_sink_mixin& e, std::size_t width, std::size_t height, std::size_t depth, const camera_source_base& source): - runner_mixin(e, width, height, depth) { + runner_mixin(e, width, height, depth, source.xoffset(), source.yoffset()) { /* Key updating after image creation */ auto& f = get_fits(); @@ -130,8 +137,8 @@ } template<class T, std::size_t Align> -fits_sink_mixin::runner_mixin<T, Align>::runner_mixin(const fits_sink_mixin& e, std::size_t width, std::size_t height, std::size_t depth, const fits_source_base&): - runner_mixin(e, width, height, depth) { +fits_sink_mixin::runner_mixin<T, Align>::runner_mixin(const fits_sink_mixin& e, std::size_t width, std::size_t height, std::size_t depth, const fits_source_base& source): + runner_mixin(e, width, height, depth, source.xoffset(), source.yoffset()) { } template<class T, std::size_t Align>
View file
domecam-0.1.7.obscpio/include/executor/gain.h -> domecam-0.1.8.obscpio/include/executor/gain.h
Changed
@@ -23,7 +23,6 @@ gain_executor(const std::string& target_uri, std::size_t pairs_number, double exp_scale, double exp_bias); virtual executor_result run(camera& c) const override; - virtual ~gain_executor() override = default; }; #endif // _EXECUTOR_GAIN_H
View file
domecam-0.1.7.obscpio/include/executor/grad.h -> domecam-0.1.8.obscpio/include/executor/grad.h
Changed
@@ -65,20 +65,17 @@ grad_executor(const std::string& target_uri, std::size_t frames_number); virtual executor_result run(camera& c) const override; - virtual ~grad_executor() override = default; }; class grad_replay_executor: public replay_executor, public grad_executor_base { private: - template<class T> - using runner_type = runner<source_mixin<T>>; + template<class T> using runner_type = runner<source_mixin<T>>; public: explicit grad_replay_executor(const std::string& target_uri); virtual executor_result run(const fits::variant_image& vi) const override; - virtual ~grad_replay_executor() override = default; }; #endif // _EXECUTOR_GRAD_H
View file
domecam-0.1.7.obscpio/include/executor/mean_pupil_mask.h -> domecam-0.1.8.obscpio/include/executor/mean_pupil_mask.h
Changed
@@ -91,7 +91,6 @@ mean_pupil_mask_executor(const std::string& target_uri, std::size_t frames_number, std::size_t samples); virtual executor_result run(camera& c) const override; - virtual ~mean_pupil_mask_executor() override = default; }; class mean_pupil_mask_replay_executor: @@ -104,7 +103,6 @@ explicit mean_pupil_mask_replay_executor(const std::string& target_uri, std::size_t samples); virtual executor_result run(const fits::variant_image& vi) const override; - virtual ~mean_pupil_mask_replay_executor() override = default; }; #endif // _EXECUTOR_MEAN_PUPIL_MASK_H
View file
domecam-0.1.7.obscpio/include/executor/mean_raw.h -> domecam-0.1.8.obscpio/include/executor/mean_raw.h
Changed
@@ -87,7 +87,6 @@ mean_raw_executor(const std::string& target_uri, std::size_t frames_number); virtual executor_result run(camera& c) const override; - virtual ~mean_raw_executor() override = default; }; class mean_raw_replay_executor: @@ -100,7 +99,6 @@ explicit mean_raw_replay_executor(const std::string& target_uri); virtual executor_result run(const fits::variant_image& vi) const override; - virtual ~mean_raw_replay_executor() override = default; }; #endif // _EXECUTOR_MEAN_H
View file
domecam-0.1.8.obscpio/include/executor/normalized_clean.h
Added
@@ -0,0 +1,86 @@ +/* + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Copyright (C) 2017-2022 Matwey V. Kornilov <matwey.kornilov@gmail.com> + */ + +#ifndef _EXECUTOR_NORMALIZED_CLEAN_H +#define _EXECUTOR_NORMALIZED_CLEAN_H + +#include <executorfwd.h> +#include <executor/fits_sink_mixin.h> +#include <executor/pipeline_mixin.h> +#include <executor/clean.h> +#include <pipeline.h> + + +struct normalized_clean_executor_base: + public clean_executor_base { +protected: + template<class SourceMixin> class runner; +public: + normalized_clean_executor_base(const std::string& target_uri, const std::string& bias_source_uri, const std::string& mask_source_uri); +}; + +template<class SourceMixin> +class normalized_clean_executor_base::runner: + public SourceMixin, + protected pipeline_mixin::runner_mixin< + normalized_clean_pipeline<typename SourceMixin::source_type::value_type>>, + protected fits_sink_mixin::runner_mixin< + typename normalized_clean_pipeline<typename SourceMixin::source_type::value_type>::result_type::value_type, + normalized_clean_pipeline<typename SourceMixin::source_type::value_type>::result_type::align>, + protected clean_executor_base::runner_base { +private: + using source_mixin = SourceMixin; + using source_type = typename source_mixin::source_type; + using pipeline_type = normalized_clean_pipeline<typename source_type::value_type>; + +public: + template<class Executor, class... Args> + runner(const Executor& e, Args&&... args): + source_mixin(e, std::forward<Args>(args)...), + pipeline_mixin::runner_mixin<pipeline_type>( + this->source().width(), + this->source().height()), + fits_sink_mixin::runner_mixin< + typename pipeline_type::result_type::value_type, + pipeline_type::result_type::align>(e, this->source()), + runner_base(e, + {this->source().xoffset(), this->source().yoffset()}, + {this->source().width(), this->source().height()}) {} + + void run(); +}; + +template<class SourceMixin> +void normalized_clean_executor_base::runner<SourceMixin>::run() { + this->for_each([this] (const typename source_type::result_type& b) { + this->append_frame(this->apply(b, bias(), mask())); + }); + + this->commit(); +} + +class normalized_clean_executor: + public camera_executor, + public normalized_clean_executor_base { +public: + normalized_clean_executor(const std::string& target_uri, std::size_t frames_number, const std::string& bias_source_uri, const std::string& mask_source_uri); + + virtual executor_result run(camera& c) const override; +}; + +class normalized_clean_replay_executor: + public replay_executor, + public normalized_clean_executor_base { +private: + template<class T> using runner_type = runner<source_mixin<T>>; +public: + normalized_clean_replay_executor(const std::string& target_uri, const std::string& bias_source_uri, const std::string& mask_source_uri); + + virtual executor_result run(const fits::variant_image& vi) const override; +}; + +#endif // _EXECUTOR_NORMALIZED_CLEAN_H +
View file
domecam-0.1.7.obscpio/include/executor/pupil.h -> domecam-0.1.8.obscpio/include/executor/pupil.h
Changed
@@ -151,7 +151,6 @@ pupil_executor(std::size_t frames_number, std::size_t samples, bool force_initial); virtual executor_result run(camera& c) const override; - virtual ~pupil_executor() override = default; }; class pupil_scan_executor: @@ -161,7 +160,6 @@ pupil_scan_executor(std::size_t frames_number, std::size_t samples, bool force_initial); virtual executor_result run(camera& c) const override; - virtual ~pupil_scan_executor() override = default; }; class pupil_replay_executor: @@ -173,7 +171,6 @@ pupil_replay_executor(std::size_t samples, bool force_initial); virtual executor_result run(const fits::variant_image& vi) const override; - virtual ~pupil_replay_executor() override = default; }; #endif // _EXECUTOR_PUPIL_H
View file
domecam-0.1.7.obscpio/include/executor/pupil_mask.h -> domecam-0.1.8.obscpio/include/executor/pupil_mask.h
Changed
@@ -76,7 +76,6 @@ pupil_mask_executor(const std::string& target_uri, std::size_t frames_number, std::size_t samples, bool force_initial); virtual executor_result run(camera& c) const override; - virtual ~pupil_mask_executor() override = default; }; class pupil_mask_replay_executor: @@ -88,7 +87,6 @@ pupil_mask_replay_executor(const std::string& target_uri, std::size_t samples, bool force_initial); virtual executor_result run(const fits::variant_image& vi) const override; - virtual ~pupil_mask_replay_executor() override = default; }; #endif // _EXECUTOR_PUPIL_MASK_H
View file
domecam-0.1.7.obscpio/include/executor/raw.h -> domecam-0.1.8.obscpio/include/executor/raw.h
Changed
@@ -56,7 +56,6 @@ raw_executor(const std::string& target_uri, std::size_t frames_number); virtual executor_result run(camera& c) const override; - virtual ~raw_executor() override = default; }; class raw_scan_executor: @@ -66,7 +65,6 @@ raw_scan_executor(const std::string& target_uri, std::size_t frames_number); virtual executor_result run(camera& c) const override; - virtual ~raw_scan_executor() override = default; }; #endif // _EXECUTOR_RAW_H
View file
domecam-0.1.7.obscpio/include/executorfwd.h -> domecam-0.1.8.obscpio/include/executorfwd.h
Changed
@@ -19,9 +19,13 @@ class executor { public: executor(); + executor(const executor&) = delete; + executor(executor&&) = delete; + executor& operator=(const executor&) = delete; + executor& operator=(executor&&) = delete; + virtual ~executor() = default; virtual executor_result run(camera& c) const = 0; - virtual ~executor() = 0; }; @@ -31,9 +35,6 @@ class source_mixin; public: explicit camera_executor(std::size_t frames_number); - - virtual executor_result run(camera& c) const = 0; - virtual ~camera_executor() = 0; protected: const std::size_t frames_number_; }; @@ -54,7 +55,6 @@ virtual executor_result run(camera& c) const override; virtual executor_result run(abstract_carriage& c) const; - virtual ~carriage_executor() = default; }; class carriage_executor::runner { @@ -73,9 +73,6 @@ class source_mixin; public: explicit scan_executor(std::size_t frames_number); - - virtual executor_result run(camera& c) const = 0; - virtual ~scan_executor() = 0; }; class scan_executor::source_mixin: @@ -95,7 +92,6 @@ template<template<class> class Runner, class Executor, class ResultType = void> class runner_visitor; public: virtual executor_result run(const fits::variant_image& vi) const = 0; - virtual ~replay_executor() = 0; }; class replay_executor::mempool_mixin {
View file
domecam-0.1.7.obscpio/include/fits.h -> domecam-0.1.8.obscpio/include/fits.h
Changed
@@ -13,12 +13,12 @@ #include <array> #include <cassert> #include <cstdint> +#include <limits> #include <memory> +#include <optional> #include <stdexcept> #include <utility> - -#include <boost/variant.hpp> -#include <boost/variant/polymorphic_get.hpp> +#include <variant> #include <fitsio.h> @@ -130,21 +130,20 @@ }; class image_base { - protected: + private: fits* fits_; std::size_t width_; std::size_t height_; std::size_t depth_; - ~image_base() = default; - + protected: void resize(std::size_t width, std::size_t height, std::size_t depth, int type); + public: image_base(fits& f, std::size_t width, std::size_t height, std::size_t depth); - image_base(image_base&&) = default; - image_base(const image_base&) = delete; - image_base& operator=(image_base&&) = default; - image_base& operator=(const image_base&) = delete; + + fits& get_fits() { return *fits_; } + const fits& get_fits() const { return *fits_; } inline std::size_t width() const { return width_; } inline std::size_t height() const { return height_; } @@ -160,33 +159,33 @@ template<std::size_t Align> void write_frame(buffer_view<T, Align> b, std::size_t frame) { int status = 0; - const long long nelements = b.size(); - const long long fpixel = 1 + width() * height() * frame; + const auto nelements = b.size(); + const auto fpixel = 1 + width() * height() * frame; assert(nelements >= 0); assert(b.size() <= width() * height()); assert(frame < depth()); - fits_write_img(fits_->file_.get(), + fits_write_img(get_fits().file_.get(), detail::type_to_cfitsio_code<T>::value, fpixel, nelements, const_cast<void*>(static_cast<const void*>(b.data())), &status); cfitsio_error::throw_on_error(status); } - template<std::size_t Align, class Allocator> + template<std::size_t Align = alignof(T), class Allocator = std::allocator<T>> buffer<T, Align, Allocator> read_frame(std::size_t frame, const Allocator& alloc = Allocator()) const { buffer<T, Align, Allocator> buf{width() * height(), alloc}; int status = 0; - const long firstelem = 1 + buf.size() * frame; - const long nelements = buf.size(); + const auto firstelem = 1 + buf.size() * frame; + const auto nelements = buf.size(); int anynul = 0; assert(static_cast<std::size_t>(nelements) == buf.size()); - fits_read_img(fits_->file_.get(), + fits_read_img(get_fits().file_.get(), detail::type_to_cfitsio_code<T>::value, firstelem, nelements, NULL, buf.data(), &anynul, &status); @@ -195,6 +194,43 @@ return buf; } + template<std::size_t Align = alignof(T), class Allocator = std::allocator<T>> + buffer<T, Align, Allocator> + read_frame_range(std::size_t frame, const std::array<std::size_t, 2>& offset, const std::array<std::size_t, 2>& size, const Allocator& alloc = Allocator()) const { + const auto& [xoffset, yoffset] = offset; + const auto& [width, height] = size; + + std::array<long, 3> fpixel{ + static_cast<long>(xoffset + 1), + static_cast<long>(yoffset + 1), + static_cast<long>(frame + 1)}; + std::array<long, 3> lpixel{ + static_cast<long>(xoffset + width), + static_cast<long>(yoffset + height), + static_cast<long>(frame + 1)}; + std::array<long, 3> inc{1, 1, 1}; + + assert(xoffset + 1 <= std::numeric_limits<long>::max()); + assert(yoffset + 1 <= std::numeric_limits<long>::max()); + assert(frame + 1 <= std::numeric_limits<long>::max()); + assert(xoffset + width <= std::numeric_limits<long>::max()); + assert(yoffset + height <= std::numeric_limits<long>::max()); + assert(frame + 1 <= std::numeric_limits<long>::max()); + + buffer<T, Align, Allocator> buf{width * height, alloc}; + int status = 0; + int anynul = 0; + + fits_read_subset(get_fits().file_.get(), + detail::type_to_cfitsio_code<T>::value, + fpixel.data(), lpixel.data(), inc.data(), + NULL, buf.data(), &anynul, &status); + + cfitsio_error::throw_on_error(status); + + return buf; + } + void resize(std::size_t width, std::size_t height, std::size_t depth) { image_base::resize(width, height, depth, detail::type_to_cfitsio_img_code<T>::value); } @@ -202,28 +238,16 @@ class variant_image { private: - using container_type = boost::variant< + using container_type = std::variant< image<uint8_t>, image<int16_t>, image<int32_t>, image<int64_t>, image<float>, - image<double> - >; + image<double>>; container_type c_; - public: - template<class T> using static_visitor = boost::static_visitor<T>; - private: - struct sizeof_visitor: public boost::static_visitor<std::size_t> { - template<class T> std::size_t operator() (const image<T>&) const { - return sizeof(T); - } - }; - inline const image_base& base() const { - return boost::polymorphic_strict_get<const image_base&>(c_); - } public: template<class T> explicit variant_image(const image<T>& im): @@ -234,33 +258,40 @@ c_(std::move(im)) { } - inline std::size_t width() const { - return base().width(); + const fits& get_fits() const { + return static_cast<const image_base&>(*this).get_fits(); + } + + std::size_t width() const { + return static_cast<const image_base&>(*this).width(); } - inline std::size_t height() const { - return base().height(); + std::size_t height() const { + return static_cast<const image_base&>(*this).height(); } - inline std::size_t depth() const { - return base().depth(); + std::size_t depth() const { + return static_cast<const image_base&>(*this).depth(); } - inline std::size_t element_size() const { - return boost::apply_visitor(sizeof_visitor{}, c_); + std::size_t element_size() const { + return std::visit([](const auto& x) { return sizeof(x); }, c_); } template<class Visitor> auto apply(Visitor&& visitor) const -> - decltype(boost::apply_visitor(std::forward<Visitor>(visitor), c_)) { - return boost::apply_visitor(std::forward<Visitor>(visitor), c_); + decltype(std::visit(std::forward<Visitor>(visitor), c_)) { + return std::visit(std::forward<Visitor>(visitor), c_); } template<class Visitor> auto apply(Visitor&& visitor) -> - decltype(boost::apply_visitor(std::forward<Visitor>(visitor), c_)) { - return boost::apply_visitor(std::forward<Visitor>(visitor), c_); + decltype(std::visit(std::forward<Visitor>(visitor), c_)) {
View file
domecam-0.1.8.obscpio/include/foldl.h
Added
@@ -0,0 +1,43 @@ +/* + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Copyright (C) 2017-2022 Matwey V. Kornilov <matwey.kornilov@gmail.com> + */ + +#ifndef _FOLDL_H +#define _FOLDL_H + +#include <cassert> +#include <functional> +#include <numeric> + +#include <buffer_view.h> + + +template<class Op, std::size_t Align> +class foldl: + private Op { +public: + using op_type = Op; + using first_argument_type = typename op_type::first_argument_type; + using second_argument_type = typename op_type::second_argument_type; + using result_type = typename op_type::result_type; + using value_type = second_argument_type; +public: + template<class... Args> + foldl(Args&&... args): + Op(std::forward<Args>(args)...) {} + + inline result_type operator() (buffer_view<value_type, Align> b) const { + return std::accumulate(b.cbegin(), b.cend(), static_cast<first_argument_type>(0), static_cast<const Op&>(*this)); + } +}; + +template<class T, std::size_t Align> +using sum = foldl<std::plus<T>, Align>; + +template<class T, std::size_t Align> +using prod = foldl<std::multiplies<T>, Align>; + +#endif // _FOLDL_H +
View file
domecam-0.1.7.obscpio/include/io.h -> domecam-0.1.8.obscpio/include/io.h
Changed
@@ -86,7 +86,8 @@ 100.0, 0.0, optional_camera_settings::packet_size_type{optional_camera_settings::auto_tag{}}, - optional_camera_settings::region_type{optional_camera_settings::full_tag{}}}; + optional_camera_settings::region_type{optional_camera_settings::full_tag{}}, + ARV_PIXEL_FORMAT_MONO_12}; load<optional_camera_settings>(pt.get_child("settings")).or_else(default_settings).apply_to(cam); @@ -113,7 +114,8 @@ load<optional_camera_settings::frame_rate_type>(pt.get_child_optional("frame_rate")), load<optional_camera_settings::gain_type>(pt.get_child_optional("gain")), load<optional_camera_settings::packet_size_type>(pt.get_child_optional("packet_size")), - load<optional_camera_settings::region_type>(pt.get_child_optional("region")) + load<optional_camera_settings::region_type>(pt.get_child_optional("region")), + {} // configuring pixel_format is not supported atm }; } }; @@ -181,6 +183,17 @@ } else if (type == "carriage_home") { return std::unique_ptr<executor>{new carriage_home_executor( pt.get<std::uint16_t>("axis"))}; + } else if (type == "clean" || type == "normalized_clean") { + const auto& filename = pt.get<std::string>("filename"); + const auto& frames_number = pt.get<std::size_t>("frames_number"); + const auto& bias_filename = pt.get<std::string>("bias_filename"); + const auto& mask_filename = pt.get<std::string>("mask_filename"); + + if (type == "clean") { + return std::unique_ptr<executor>{new clean_executor(filename, frames_number, bias_filename, mask_filename)}; + } else if (type == "normalized_clean") { + return std::unique_ptr<executor>{new normalized_clean_executor(filename, frames_number, bias_filename, mask_filename)}; + } } throw std::runtime_error(std::string("Unknown executor type ") + type);
View file
domecam-0.1.7.obscpio/include/iofwd.h -> domecam-0.1.8.obscpio/include/iofwd.h
Changed
@@ -7,6 +7,7 @@ #ifndef _IOFWD_H #define _IOFWD_H +#include <optional> #include <sstream> #include <utility> // std::forward @@ -35,8 +36,8 @@ return detail::load1<T>(pt, static_cast<int>(0), std::forward<Args>(args)...); } template<class T, class... Args> inline auto load(const boost::optional<const boost::property_tree::ptree&>& pt, Args&&... args) -> - boost::optional<decltype(detail::load1<T>(*pt, static_cast<int>(0), std::forward<Args>(args)...))> { - typedef boost::optional<decltype(detail::load1<T>(*pt, static_cast<int>(0), std::forward<Args>(args)...))> return_type; + std::optional<decltype(detail::load1<T>(*pt, static_cast<int>(0), std::forward<Args>(args)...))> { + typedef std::optional<decltype(detail::load1<T>(*pt, static_cast<int>(0), std::forward<Args>(args)...))> return_type; if (pt) { return return_type(detail::load1<T>(*pt, static_cast<int>(0), std::forward<Args>(args)...)); }
View file
domecam-0.1.7.obscpio/include/pipeline.h -> domecam-0.1.8.obscpio/include/pipeline.h
Changed
@@ -14,11 +14,13 @@ #include <binary.h> #include <buffer.h> #include <buffer_view.h> +#include <clean.h> #include <convert.h> #include <edge_entropy.h> #include <edge_select.h> #include <element_wise.h> #include <error.h> +#include <foldl.h> #include <grad.h> #include <mempool.h> #include <pupil_geom.h> @@ -322,4 +324,74 @@ return divides_op_(accum, count); } +template<class InpT> +class clean_pipeline: + public pipeline_base<InpT, float> { +public: + using typename pipeline_base<InpT, float>::value_type; + using typename pipeline_base<InpT, float>::mempool_type; + using typename pipeline_base<InpT, float>::allocator_type; +private: + using clean_type = clean<value_type, mempool_type::align, allocator_type>; +protected: + using pipeline_base<InpT, float>::pool_; + using pipeline_base<InpT, float>::convert_; +public: + using mask_type = typename clean_type::mask_type; + using result_type = typename clean_type::buffer_type; +protected: + clean_type clean_; +public: + clean_pipeline(std::size_t width, std::size_t height): + pipeline_base<InpT, float>(mempool_type(width * height * sizeof(float), 2)), + clean_{width, height, typename clean_type::allocator_type(pool_)} { + } + + inline result_type operator() (buffer_view<InpT, mempool_type::align> b, buffer_view<float> bias, buffer_view<mask_type> mask) const; + + inline std::size_t width() const { return clean_.width(); } + inline std::size_t height() const { return clean_.height(); } +}; + +template<class InpT> +typename clean_pipeline<InpT>::result_type +clean_pipeline<InpT>::operator() (buffer_view<InpT, mempool_type::align> b, buffer_view<float> bias, buffer_view<mask_type> mask) const { + const auto& c = convert_(b); + return clean_(c, bias, mask); +} + +template<class InpT> +class normalized_clean_pipeline: + public clean_pipeline<InpT> { +public: + using typename pipeline_base<InpT, float>::value_type; + using typename pipeline_base<InpT, float>::mempool_type; + using typename pipeline_base<InpT, float>::allocator_type; + using typename clean_pipeline<InpT>::mask_type; +private: + using sum_op_type = sum<value_type, mempool_type::align>; + using divides_op_type = element_divides<value_type, mempool_type::align>; +protected: + using clean_pipeline<InpT>::clean_; +public: + using buffer_type = buffer<value_type, mempool_type::align, allocator_type>; + using result_type = buffer_type; +private: + sum_op_type sum_op_; + divides_op_type divides_op_; +public: + normalized_clean_pipeline(std::size_t width, std::size_t height): + clean_pipeline<InpT>(width, height) {} + + inline result_type operator() (buffer_view<InpT, mempool_type::align> b, buffer_view<float> bias, buffer_view<mask_type> mask) const; +}; + +template<class InpT> +typename normalized_clean_pipeline<InpT>::result_type +normalized_clean_pipeline<InpT>::operator() (buffer_view<InpT, mempool_type::align> b, buffer_view<float> bias, buffer_view<mask_type> mask) const { + auto c = clean_pipeline<InpT>::operator()(b, bias, mask); + divides_op_(c, sum_op_(c)); + return c; +} + #endif // _PIPELINE_H
View file
domecam-0.1.7.obscpio/include/source.h -> domecam-0.1.8.obscpio/include/source.h
Changed
@@ -79,6 +79,9 @@ std::size_t height() const { return std::get<1>(settings_.region().size); } std::size_t depth() const { return depth_; } + std::size_t xoffset() const { return std::get<0>(settings_.region().offset); } + std::size_t yoffset() const { return std::get<1>(settings_.region().offset); } + const camera_settings& settings() const { return settings_; } @@ -185,12 +188,18 @@ class fits_source_base { protected: const fits::image_base& image_; + std::size_t xoffset_; + std::size_t yoffset_; + public: explicit fits_source_base(const fits::image_base& image); std::size_t width() const { return image_.width(); } std::size_t height() const { return image_.height(); } std::size_t depth() const { return image_.depth(); } + + std::size_t xoffset() const { return xoffset_; } + std::size_t yoffset() const { return yoffset_; } }; template<class T, std::size_t Align, class Allocator>
View file
domecam-0.1.7.obscpio/src/camera.cpp -> domecam-0.1.8.obscpio/src/camera.cpp
Changed
@@ -113,12 +113,21 @@ return binning(); } -const char* camera::pixel_format() { +const char* camera::pixel_format_as_string() { return arv_error::apply_or_throw(&arv_camera_get_pixel_format_as_string, camera_.get()); } const char* camera::pixel_format(const std::string& pixel_format_) { arv_error::apply_or_throw(&arv_camera_set_pixel_format_from_string, camera_.get(), pixel_format_.c_str()); + return pixel_format_as_string(); +} + +camera::pixel_format_type camera::pixel_format() { + return arv_error::apply_or_throw(&arv_camera_get_pixel_format, camera_.get()); +} +camera::pixel_format_type camera::pixel_format(pixel_format_type pixel_format_) { + arv_error::apply_or_throw(&arv_camera_set_pixel_format, camera_.get(), pixel_format_); + return pixel_format(); }
View file
domecam-0.1.7.obscpio/src/camera_settings.cpp -> domecam-0.1.8.obscpio/src/camera_settings.cpp
Changed
@@ -9,38 +9,37 @@ namespace { template<class T, class U> -boost::optional<T> rebase_helper(const boost::optional<T>& our, const U& base, const U& target) { - using boost::none; - using boost::make_optional; - +std::optional<T> rebase_helper(const std::optional<T>& our, const U& base, const U& target) { return our ? our : - (base != target ? make_optional(static_cast<T>(target)) : boost::none); + (base != target ? std::make_optional(static_cast<T>(target)) : std::nullopt); } } -constexpr camera_settings::camera_settings(const binning_type& binning, exposure_time_type exposure_time, frame_rate_type frame_rate, gain_type gain, packet_size_type packet_size, const region_type& region): +constexpr camera_settings::camera_settings(const binning_type& binning, exposure_time_type exposure_time, frame_rate_type frame_rate, gain_type gain, packet_size_type packet_size, const region_type& region, pixel_format_type pixel_format): frame_rate_(frame_rate), gain_(gain), exposure_time_(exposure_time), binning_(binning), region_(region), - packet_size_(packet_size) { + packet_size_(packet_size), + pixel_format_(pixel_format) { } camera_settings::camera_settings(camera& cam): - camera_settings(cam.binning(), cam.exposure_time(), cam.frame_rate(), cam.gain(), cam.packet_size(), cam.region()) { + camera_settings(cam.binning(), cam.exposure_time(), cam.frame_rate(), cam.gain(), cam.packet_size(), cam.region(), cam.pixel_format()) { } -optional_camera_settings::optional_camera_settings(const boost::optional<binning_type>& binning, boost::optional<exposure_time_type> exposure_time, boost::optional<frame_rate_type> frame_rate, boost::optional<gain_type> gain, boost::optional<packet_size_type> packet_size, const boost::optional<region_type>& region): +optional_camera_settings::optional_camera_settings(const std::optional<binning_type>& binning, std::optional<exposure_time_type> exposure_time, std::optional<frame_rate_type> frame_rate, std::optional<gain_type> gain, std::optional<packet_size_type> packet_size, const std::optional<region_type>& region, const std::optional<pixel_format_type>& pixel_format): frame_rate_(frame_rate), gain_(gain), exposure_time_(exposure_time), binning_(binning), region_(region), - packet_size_(packet_size) { + packet_size_(packet_size), + pixel_format_(pixel_format) { } optional_camera_settings::optional_camera_settings(const camera_settings& es): @@ -49,7 +48,8 @@ exposure_time_(es.exposure_time()), binning_(es.binning()), region_(es.region()), - packet_size_(es.packet_size()) { + packet_size_(es.packet_size()), + pixel_format_(es.pixel_format()) { } optional_camera_settings& optional_camera_settings::operator=(const camera_settings& es) { @@ -84,6 +84,10 @@ if (packet_size_) { apply_packet_size(cam, *packet_size_); } + + if (pixel_format_) { + cam.pixel_format(*pixel_format_); + } } optional_camera_settings& optional_camera_settings::rebase(const camera_settings& base, const camera_settings& target) { @@ -93,7 +97,8 @@ rebase_helper(frame_rate_, base.frame_rate(), target.frame_rate()), rebase_helper(gain_, base.gain(), target.gain()), rebase_helper(packet_size_, base.packet_size(), target.packet_size()), - rebase_helper(region_, base.region(), target.region()) + rebase_helper(region_, base.region(), target.region()), + rebase_helper(pixel_format_, base.pixel_format(), target.pixel_format()) }; std::swap(tmp, *this); @@ -108,13 +113,12 @@ frame_rate_ ? frame_rate_ : other.frame_rate_, gain_ ? gain_ : other.gain_, packet_size_ ? packet_size_ : other.packet_size_, - region_ ? region_ : other.region_}; + region_ ? region_ : other.region_, + pixel_format_ ? pixel_format_ : other.pixel_format_}; } void optional_camera_settings::apply_region(camera& cam, const region_type& region) const { struct visitor { - using result_type = camera::region_type; - camera::region_type operator() (const full_tag&) const { return cam_.full_region(); } @@ -126,13 +130,11 @@ camera& cam_; }; - boost::apply_visitor(visitor{cam}, region); + std::visit(visitor{cam}, region); } void optional_camera_settings::apply_packet_size(camera& cam, const packet_size_type& packet_size) const { struct visitor { - using result_type = std::size_t; - std::size_t operator() (const auto_tag&) const { return cam_.auto_packet_size(); } @@ -144,6 +146,6 @@ camera& cam_; }; - boost::apply_visitor(visitor{cam}, packet_size); + std::visit(visitor{cam}, packet_size); }
View file
domecam-0.1.7.obscpio/src/error.cpp -> domecam-0.1.8.obscpio/src/error.cpp
Changed
@@ -16,6 +16,12 @@ error(what) { } +aux_image_incorrect_position::aux_image_incorrect_position(const std::string& source_uri, const std::array<std::size_t, 2>& offset, const std::array<std::size_t, 2>& size): + validation_error(std::string("Requested region (") + + std::to_string(size[0]) + "x" + std::to_string(size[1]) + " @ " + + std::to_string(offset[0]) + "," + std::to_string(offset[1]) + ") is not covered by " + source_uri) { +} + empty_frame::empty_frame(): validation_error("Frame is empty") { }
View file
domecam-0.1.7.obscpio/src/executor/carriage.cpp -> domecam-0.1.8.obscpio/src/executor/carriage.cpp
Changed
@@ -30,7 +30,7 @@ } -carriage_track_executor::carriage_track_executor(const boost::optional<std::uint16_t>& axis, abstract_carriage::direction d): +carriage_track_executor::carriage_track_executor(const std::optional<std::uint16_t>& axis, abstract_carriage::direction d): carriage_executor(), axis_{axis}, direction_{d} { @@ -68,7 +68,7 @@ } -carriage_run_executor::carriage_run_executor(const boost::optional<std::uint16_t>& axis, std::int16_t absolute_pos): +carriage_run_executor::carriage_run_executor(const std::optional<std::uint16_t>& axis, std::int16_t absolute_pos): carriage_executor(), axis_(axis), absolute_pos_(absolute_pos) { @@ -106,7 +106,7 @@ c_.home(); } -carriage_home_executor::carriage_home_executor(const boost::optional<std::uint16_t>& axis): +carriage_home_executor::carriage_home_executor(const std::optional<std::uint16_t>& axis): carriage_executor(), axis_(axis) { }
View file
domecam-0.1.8.obscpio/src/executor/clean.cpp
Added
@@ -0,0 +1,154 @@ +/* + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Copyright (C) 2017-2022 Matwey V. Kornilov <matwey.kornilov@gmail.com> + */ + +#include <executor/clean.h> + +namespace { + std::pair<std::array<std::size_t, 2>, std::array<std::size_t, 2>> unpack_image_region(const fits& f) { + return {{f.read_key_optional<std::uint32_t>("XOFFSET").value_or(0), + f.read_key_optional<std::uint32_t>("YOFFSET").value_or(0)}, + {f.image_dimensions().width, + f.image_dimensions().height}}; + } + + std::optional<std::array<std::size_t, 2>> relative_region(const std::array<std::size_t, 2>& offset, const std::array<std::size_t, 2>& size, const std::array<std::size_t, 2>& target_offset, const std::array<std::size_t, 2>& target_size) { + const auto& [xoffset, yoffset] = offset; + const auto& [target_xoffset, target_yoffset] = target_offset; + const auto& [width, height] = size; + const auto& [target_width, target_height] = target_size; + + if (xoffset < target_xoffset || yoffset < target_yoffset) + return {}; + + if (target_width < width || target_height < height) + return {}; + + const std::array<std::size_t, 2> rel_offset{ + target_xoffset - xoffset, target_yoffset - yoffset}; + + if (target_width - width < rel_offset[0] || target_height - height < rel_offset[1]) + return {}; + + return rel_offset; + } +} + + +clean_executor_base::clean_executor_base(const std::string& target_uri, const std::string& bias_source_uri, const std::string& mask_source_uri): + fits_sink_mixin(target_uri), + pipeline_mixin(), + bias_source_uri_{bias_source_uri}, + mask_source_uri_{mask_source_uri} {} + +std::pair<clean_executor_base::runner_base::mask_buffer_type, std::size_t> +clean_executor_base::runner_base::load_mask_image(const std::string& mask_source_uri, const std::array<std::size_t, 2>& offset, const std::array<std::size_t, 2>& size) { + constexpr std::size_t mask_capacity = sizeof(mask_buffer_type::value_type) * 8; + const auto& [width, height] = size; + + assert(width > 0); + assert(height > 0); + + std::pair<mask_buffer_type, std::size_t> ret{{(width * height - 1) / mask_capacity + 1}, 0}; + auto& mask = ret.first; + auto& count = ret.second; + auto mask_it = mask.begin(); + + fits mask_fits{mask_source_uri}; + const auto [image_offset, image_size] = unpack_image_region(mask_fits); + const auto rel_offset = relative_region(offset, size, image_offset, image_size); + if (!rel_offset) + throw aux_image_incorrect_position{mask_source_uri, offset, size}; + + mask_fits.load_image().apply([&] (const auto& image) { + const auto frame = image.read_frame_range(0, *rel_offset, size); + + for (auto it = frame.cbegin(); it != frame.cend(); ++mask_it) { + *mask_it = 0; + for (std::size_t bit = 0; + bit < mask_capacity && it != frame.cend(); + ++bit, ++it) { + + if (*it != 0) { + *mask_it |= 1 << bit; + ++count; + } + } + } + }); + + assert(mask_it == mask.end()); + + return ret; +} + +clean_executor_base::runner_base::bias_buffer_type +clean_executor_base::runner_base::load_bias_image(const std::string& bias_source_uri, const std::array<std::size_t, 2>& offset, const std::array<std::size_t, 2>& size, const mask_buffer_type& mask, std::size_t active_count) { + constexpr std::size_t mask_capacity = sizeof(mask_buffer_type::value_type) * 8; + + bias_buffer_type ret{active_count}; + auto bias_it = ret.begin(); + auto mask_it = mask.cbegin(); + + fits bias_fits{bias_source_uri}; + const auto [image_offset, image_size] = unpack_image_region(bias_fits); + const auto rel_offset = relative_region(offset, size, image_offset, image_size); + if (!rel_offset) + throw aux_image_incorrect_position{bias_source_uri, offset, size}; + + bias_fits.load_image().apply([&] (const auto& image) { + const auto frame = image.read_frame_range(0, *rel_offset, size); + + for (auto it = frame.cbegin(); it != frame.cend(); ++mask_it) { + for (std::size_t bit = 0; + bit < mask_capacity && it != frame.cend(); + ++bit, ++it) { + + if (*mask_it & (1 << bit)) { + *bias_it++ = *it; + } + } + } + }); + + assert(bias_it == ret.end()); + assert(mask_it == mask.cend()); + + return ret; +} + +clean_executor_base::runner_base::runner_base(std::pair<mask_buffer_type, std::size_t>&& mask, const std::string& bias_source_uri, const std::array<std::size_t, 2>& offset, const std::array<std::size_t, 2>& size): + mask_{std::move(mask.first)}, + bias_{load_bias_image(bias_source_uri, offset, size, mask_, mask.second)} {} + +clean_executor_base::runner_base::runner_base(const std::string& bias_source_uri, const std::string& mask_source_uri, const std::array<std::size_t, 2>& offset, const std::array<std::size_t, 2>& size): + runner_base(load_mask_image(mask_source_uri, offset, size), bias_source_uri, offset, size) {} + +clean_executor_base::runner_base::runner_base(const clean_executor_base& e, const std::array<std::size_t, 2>& offset, const std::array<std::size_t, 2>& size): + runner_base(e.bias_source_uri_, e.mask_source_uri_, offset, size) {} + + +clean_executor::clean_executor(const std::string& target_uri, std::size_t frames_number, const std::string& bias_source_uri, const std::string& mask_source_uri): + camera_executor(frames_number), + clean_executor_base(target_uri, bias_source_uri, mask_source_uri) {} + +executor_result clean_executor::run(camera& c) const { + runner<source_mixin> r{*this, c}; + + r.run(); + + return {}; +} + + +clean_replay_executor::clean_replay_executor(const std::string& target_uri, const std::string& bias_source_uri, const std::string& mask_source_uri): + replay_executor(), + clean_executor_base(target_uri, bias_source_uri, mask_source_uri) {} + +executor_result clean_replay_executor::run(const fits::variant_image& vi) const { + vi.apply(runner_visitor<runner_type, clean_replay_executor>{*this}); + + return {}; +}
View file
domecam-0.1.7.obscpio/src/executor/gain.cpp -> domecam-0.1.8.obscpio/src/executor/gain.cpp
Changed
@@ -13,8 +13,8 @@ const gain_executor& e_; camera& c_; - runner(const gain_executor& e, camera& c): - fits_sink_mixin::runner_mixin<std::uint16_t, camera_source<std::uint16_t>::align>(e, std::get<0>(c.region().size), std::get<1>(c.region().size), e.frames_number_), + runner(const gain_executor& e, camera& c, const camera::region_type& region): + fits_sink_mixin::runner_mixin<std::uint16_t, camera_source<std::uint16_t>::align>(e, std::get<0>(region.size), std::get<1>(region.size), e.frames_number_, std::get<0>(region.offset), std::get<1>(region.offset)), e_(e), c_(c) { @@ -26,6 +26,8 @@ f.update_key("XBINNING", std::get<0>(binning)); f.update_key("YBINNING", std::get<1>(binning)); } + runner(const gain_executor& e, camera& c): + runner(e, c, c.region()) {} void run(); };
View file
domecam-0.1.8.obscpio/src/executor/normalized_clean.cpp
Added
@@ -0,0 +1,34 @@ +/* + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Copyright (C) 2017-2022 Matwey V. Kornilov <matwey.kornilov@gmail.com> + */ + +#include <executor/normalized_clean.h> + +normalized_clean_executor_base::normalized_clean_executor_base(const std::string& target_uri, const std::string& bias_source_uri, const std::string& mask_source_uri): + clean_executor_base(target_uri, bias_source_uri, mask_source_uri) {} + + +normalized_clean_executor::normalized_clean_executor(const std::string& target_uri, std::size_t frames_number, const std::string& bias_source_uri, const std::string& mask_source_uri): + camera_executor(frames_number), + normalized_clean_executor_base(target_uri, bias_source_uri, mask_source_uri) {} + +executor_result normalized_clean_executor::run(camera& c) const { + runner<source_mixin> r{*this, c}; + + r.run(); + + return {}; +} + + +normalized_clean_replay_executor::normalized_clean_replay_executor(const std::string& target_uri, const std::string& bias_source_uri, const std::string& mask_source_uri): + replay_executor(), + normalized_clean_executor_base(target_uri, bias_source_uri, mask_source_uri) {} + +executor_result normalized_clean_replay_executor::run(const fits::variant_image& vi) const { + vi.apply(runner_visitor<runner_type, normalized_clean_replay_executor>{*this}); + + return {}; +}
View file
domecam-0.1.7.obscpio/src/executorfwd.cpp -> domecam-0.1.8.obscpio/src/executorfwd.cpp
Changed
@@ -14,8 +14,6 @@ executor::executor() = default; -executor::~executor() = default; - camera_executor::source_mixin::source_mixin(const camera_executor& e, camera& c): ::source_mixin<source_type>(c, e.frames_number_, std::chrono::seconds(5), 20) {} @@ -25,8 +23,6 @@ executor(), frames_number_(frames_number) {} -camera_executor::~camera_executor() = default; - carriage_executor::runner::runner(abstract_carriage& c): c_(c) { @@ -74,10 +70,6 @@ scan_executor::scan_executor(std::size_t frames_number): camera_executor(frames_number) {} -scan_executor::~scan_executor() = default; - replay_executor::mempool_mixin::mempool_mixin(std::size_t size): pool_{size, 1} {} - -replay_executor::~replay_executor() = default;
View file
domecam-0.1.7.obscpio/src/fits.cpp -> domecam-0.1.8.obscpio/src/fits.cpp
Changed
@@ -135,11 +135,11 @@ int status = 0; int bitpix; int naxis; - long naxes[maxdim] = {1, 1, 1}; + std::array<long long, maxdim> naxes{1, 1, 1}; std::size_t width, height, depth; - fits_get_img_param(file_.get(), maxdim, &bitpix, &naxis, naxes, &status); + fits_get_img_paramll(file_.get(), maxdim, &bitpix, &naxis, naxes.data(), &status); cfitsio_error::throw_on_error(status); assert(bitpix != 0); @@ -149,9 +149,9 @@ height = static_cast<std::size_t>(naxes[1]); depth = static_cast<std::size_t>(naxes[2]); - assert(static_cast<long>(width) == naxes[0]); - assert(static_cast<long>(height) == naxes[1]); - assert(static_cast<long>(depth) == naxes[2]); + assert(static_cast<long long>(width) == naxes[0]); + assert(static_cast<long long>(height) == naxes[1]); + assert(static_cast<long long>(depth) == naxes[2]); return dimensions{width, height, depth, bitpix}; }
View file
domecam-0.1.7.obscpio/src/mempool.cpp -> domecam-0.1.8.obscpio/src/mempool.cpp
Changed
@@ -20,7 +20,11 @@ assert(size_ % align_ == 0); const std::size_t full_size = size_ * chunks + align_; +#if __cpp_aligned_new >= 201606L + mem_.reset(new (std::align_val_t(align_)) char[full_size]); +#else mem_.reset(new char[full_size]); +#endif char* c = mem_.get(); c = reinterpret_cast<char*>((reinterpret_cast<std::uintptr_t>(c) + align_ - 1) & -align_);
View file
domecam-0.1.7.obscpio/src/source.cpp -> domecam-0.1.8.obscpio/src/source.cpp
Changed
@@ -32,7 +32,6 @@ timeout_(timeout), stream_(camera_.make_stream(capture_buffers)) { - camera_.pixel_format("Mono12"); camera_.clear_triggers(); } @@ -77,7 +76,9 @@ } fits_source_base::fits_source_base(const fits::image_base& image): - image_(image) { + image_{image}, + xoffset_{image.get_fits().read_key_optional<std::uint32_t>("XOFFSET").value_or(0)}, + yoffset_{image.get_fits().read_key_optional<std::uint32_t>("YOFFSET").value_or(0)} { } constexpr std::uint16_t scan_source_base::max_range_;
View file
domecam-0.1.7.obscpio/test/buffer.cpp -> domecam-0.1.8.obscpio/test/buffer.cpp
Changed
@@ -10,6 +10,7 @@ #include <cppunit/TestAssert.h> #include <algorithm> +#include <array> #include <string> #include <sstream> #include <numeric>
View file
domecam.obsinfo
Changed
@@ -1,3 +1,3 @@ name: domecam -version: 0.1.7 -mtime: 1651845130 +version: 0.1.8 +mtime: 1663669895
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.