/usr/share/doc/enfuse/examples/exposure_weight_base.h is in enfuse 4.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | /*
* Copyright (C) 2013-2016 Dr. Christoph L. Spiel
*
* This file is part of Enblend.
*/
#ifndef EXPOSURE_WEIGHT_BASE_INCLUDED
#define EXPOSURE_WEIGHT_BASE_INCLUDED
#include <stdexcept>
#include <string>
#include <vector>
#include <iterator>
// Version number of the interface-to-user-weight functions.
#define EXPOSURE_WEIGHT_INTERFACE_VERSION 2
// The full width at half of the maximum of the Gauss-curve we use for
// exposure weighting is
// FWHM = 2 * sqrt(2 * log(2))
// For compatibility in the sake of least surprise of the user, all
// other exposure weight functions rescale their native FWHM to match
// the Gauss-curve.
#define FWHM_GAUSSIAN 2.3548200450309493820231386529193992755
class ExposureWeight
{
public:
typedef std::vector<std::string> argument_list_t;
typedef argument_list_t::const_iterator argument_const_iterator;
ExposureWeight() : y_optimum_(0.5), width_(0.2) {}
ExposureWeight(double y_optimum, double width_parameter) :
y_optimum_(y_optimum), width_(width_parameter)
{
check_invariant();
}
virtual void initialize(double y_optimum, double width_parameter,
argument_const_iterator arguments_begin,
argument_const_iterator arguments_end)
{
y_optimum_ = y_optimum;
width_ = width_parameter;
arguments_.clear();
std::copy(arguments_begin, arguments_end, std::back_inserter(arguments_));
check_invariant();
}
double optimum() const {return y_optimum_;}
double width() const {return width_;}
const argument_list_t& arguments() const {return arguments_;}
virtual double normalize(double y) const {return (y - optimum()) / width();}
virtual double weight(double) = 0;
virtual ~ExposureWeight() {}
struct error : public std::runtime_error
{
error(const std::string& message) : std::runtime_error(message) {}
};
virtual int interface_version() const {return EXPOSURE_WEIGHT_INTERFACE_VERSION;}
private:
void check_invariant() const
{
if (y_optimum_ < 0.0 || y_optimum_ > 1.0)
{
throw std::invalid_argument("y_optimum");
}
if (width_ <= 0.0)
{
throw std::invalid_argument("width_parameter");
}
}
double y_optimum_;
double width_;
argument_list_t arguments_;
};
#endif // EXPOSURE_WEIGHT_BASE_INCLUDED
// Local Variables:
// mode: c++
// End:
|