00001 #ifndef __MLFILTER_H__
00002 #define __MLFILTER_H__
00003
00004 #include <vector>
00005
00006 #include <stdint.h>
00007
00008 #include "utils.h"
00009 #include "image.h"
00010 #include "processor.h"
00011 #include "thread.h"
00012
00013 namespace noise
00014 {
00015
00016 class ChromaNoise;
00018
00019 class HPassJob : public thread::Job
00020 {
00021 public:
00022 HPassJob(const spectral::Image *sourceImage,
00023 const std::vector<float> &kernel,
00024 uint32_t first,
00025 uint32_t last,
00026 spectral::Image *destImage);
00027
00028 virtual void Process(void);
00029
00030 private:
00031 const spectral::Image *m_sourceImage;
00032 spectral::Image *m_destImage;
00033 const std::vector<float> &m_kernel;
00034 const uint32_t m_first, m_last;
00035 };
00036
00038
00039 class VPassJob : public thread::Job
00040 {
00041 public:
00042 VPassJob(const spectral::Image *sourceImage,
00043 const std::vector<float> &kernel,
00044 uint32_t first,
00045 uint32_t last,
00046 spectral::Image *destImage);
00047
00048 virtual void Process(void);
00049
00050 private:
00051 const spectral::Image *m_sourceImage;
00052 spectral::Image *m_destImage;
00053 const std::vector<float> &m_kernel;
00054 const uint32_t m_first, m_last;
00055 };
00056
00058
00059 class ChromaNoiseFarmer : public thread::Farmer
00060 {
00061 public:
00062 ChromaNoiseFarmer(ChromaNoise*,
00063 float initialProgress,
00064 float jobWeight);
00065 virtual void ProcessCompletedJob(thread::Job *);
00066 private:
00067 float m_initialProgress, m_jobWeight;
00068 ChromaNoise *m_owner;
00069 };
00070
00071
00073
00075 class ChromaNoise : public spectral::Processor
00076 {
00077 public:
00078 ChromaNoise();
00079 ~ChromaNoise();
00080
00081
00082
00083 virtual uint32_t GetInterface(
00084 std::list<std::pair<uint32_t, uint32_t> > &mandatory,
00085 std::list<std::pair<uint32_t, uint32_t> > &optional) const;
00086
00087
00088 virtual bool SetImage(uint32_t slot, const spectral::Image *img);
00089
00090
00091 virtual void SetParameters(const spectral::Parameters *);
00092
00093
00094 virtual spectral::Image *Process(void);
00095
00096
00097 virtual void ClearImage(uint32_t slot);
00098
00099 protected:
00100
00101
00102 virtual void GetParameters(spectral::Parameters *) const;
00103
00104 private:
00105 const spectral::Image *m_image;
00106 int32_t m_filter_size;
00107 int32_t m_threshold;
00108 };
00109
00110 }
00111
00112 #endif