Streamtools: Add FLAC output driver
[jpcrr.git] / streamtools / resize-linear-separable.hpp
blob8c3144c629237f966a9e0dff9628813df593407d
1 #ifndef _resize_linear_separable__hpp__included__
2 #define _resize_linear_separable__hpp__included__
4 #include "resize.hpp"
6 #define MAXCOEFFICIENTS 256
8 typedef signed long long position_t;
12 class resizer_linear_separable : public resizer
14 public:
15 void operator()(uint8_t* target, uint32_t twidth, uint32_t theight,
16 const uint8_t* source, uint32_t swidth, uint32_t sheight);
17 protected:
18 //Fill coeffs, base and coeffcount. Coeffs is set of floating-point coefficients for pixels
19 //starting from pixel number base (zero-based) and numbering coeffcount. Take care not to refer
20 //to pixel outside range [0,width). Twidth is target width.
21 //num / denum gives position of pixel being approximated. The coordinate range is [0, width),
22 //width giving the width of original data.
23 virtual void compute_coeffs(float* coeffs, position_t num, position_t denum, position_t width,
24 position_t twidth, unsigned& base, unsigned& coeffcount) = 0;
27 class simple_resizer_linear_separable : public resizer_factory
29 public:
30 simple_resizer_linear_separable(const std::string& type, void(*coeffs_fn)(float* coeffs, position_t num,
31 position_t denum, position_t width, position_t twidth, unsigned& base, unsigned& coeffcount));
32 simple_resizer_linear_separable(const std::string& type, void(*coeffs_fn)(float* coeffs, position_t num,
33 position_t denum, position_t width, position_t twidth, unsigned& base, unsigned& coeffcount,
34 int algo), int algo);
35 resizer& make(const std::string& type);
36 private:
37 void(*coeffs_fn)(float* coeffs, position_t newsize, position_t oldsize, position_t width, position_t twidth,
38 unsigned& base, unsigned& coeffcount);
39 void(*coeffs_fn2)(float* coeffs, position_t newsize, position_t oldsize, position_t width,
40 position_t twidth, unsigned& base, unsigned& coeffcount, int algo);
41 int algo;
44 #endif