include/sampler.h
branchpyrit
changeset 48 a4913301c626
parent 47 320d5d466864
child 49 558fde7da82a
equal deleted inserted replaced
47:320d5d466864 48:a4913301c626
    75 	int sx,sy;
    75 	int sx,sy;
    76 };
    76 };
    77 
    77 
    78 /**
    78 /**
    79  * Default sampler.
    79  * Default sampler.
       
    80  * Implements basic adaptive subsampling and oversampling.
    80  */
    81  */
    81 class DefaultSampler: public Sampler
    82 class DefaultSampler: public Sampler
    82 {
    83 {
    83 	int phase;
    84 	int phase;
       
    85 	int subsample;
       
    86 	int oversample; // 0 = no, 1 = 5x, 2 = 9x, 3 = 16x
    84 public:
    87 public:
    85 	DefaultSampler(Float *abuffer, int &aw, int &ah): Sampler(abuffer, aw, ah), phase(-1) {};
    88 	DefaultSampler(Float *abuffer, int &aw, int &ah):
    86 	void init() { phase = 0; };
    89 		Sampler(abuffer, aw, ah), phase(-1), subsample(8), oversample(0) {};
       
    90 	void init();
    87 	int initSampleSet();
    91 	int initSampleSet();
    88 	Sample *nextSample(Sample *prev);
    92 	Sample *nextSample(Sample *prev);
    89 	void saveSample(Sample *samp, Colour &col);
    93 	void saveSample(Sample *samp, Colour &col);
       
    94 
       
    95 	void setSubsample(int sub) { subsample = sub; };
       
    96 	int getSubsample() { return subsample; };
       
    97 	void setOversample(int osa) { oversample = osa; };
       
    98 	int getOversample() { return oversample; };
    90 };
    99 };
    91 
   100 
    92 #endif
   101 #endif