Skip to content
Snippets Groups Projects
Commit b2724043 authored by Antoine Lorence's avatar Antoine Lorence
Browse files

[Quantif] Remove useless Quantifier class

parent 7ced6897
No related branches found
No related tags found
No related merge requests found
......@@ -171,8 +171,3 @@ Quantification Quantification::nonLinearQuantOptimized(int size, const Image* im
return quant;
}
Quantifier::Quantifier(Quantification quant) {
for(int i = 0; i < N_MAX_THRESHOLD; ++i) {
values[i] = quant.valueOf(i);
}
}
......@@ -32,22 +32,22 @@ public:
void saveAs(std::string filename);
inline int valueOf(int value) const {
for(int i = 0; i < this->size - 1; ++i) {
if(value < this->_threshold[i]) {
return this->_values[i];
for(int i = 0; i < nbThresholds(); ++i) {
if(value < _threshold[i]) {
return _values[i];
}
}
return this->_values[this->size - 1];
return _values[nbThresholds()];
}
inline int nbValues() {return size;}
inline int nbValues() const {return size;}
inline int nbThresholds() {return size - 1;}
inline int nbThresholds() const {return size - 1;}
inline int value(int i) {return _values[i];}
inline int value(int i) const {return _values[i];}
inline void setValue(int i, int v) {_values[i] = v;}
inline int threshold(int i) {return _threshold[i];}
inline int threshold(int i) const {return _threshold[i];}
inline void setThreshold(int i, int v) {_threshold[i] = v;}
static Quantification linearQuant(int size);
......@@ -60,14 +60,4 @@ private:
int* _values;
};
class Quantifier {
public:
Quantifier(Quantification quant);
inline int valueOf(imagein::Image::depth_t value) {
return this->values[value];
}
private:
int values[N_MAX_THRESHOLD];
};
#endif // QUANTIFICATION_H
......@@ -64,11 +64,10 @@ void QuantificationOp::operator()(const imagein::Image* image, const std::map<co
cout << quantification.threshold(i) << ".";
}
cout << endl;
Quantifier quantifier = Quantifier(quantification);
for(unsigned int j = 0; j < image->getHeight(); ++j) {
for(unsigned int i = 0; i < image->getWidth(); ++i) {
const Image::depth_t value = image->getPixelAt(i, j, c);
resImg->setPixelAt(i, j, c, quantifier.valueOf(value));
resImg->setPixelAt(i, j, c, quantification.valueOf(value));
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment