Added new mode "Horizontal on PDAF rows only" for the "line noise filter"

This commit is contained in:
Alberto Griggio
2018-03-10 22:56:45 +01:00
parent 478ebb1a49
commit 81210d18b4
8 changed files with 79 additions and 9 deletions

View File

@@ -128,6 +128,39 @@ private:
std::vector<std::vector<float>> tiles_;
};
class PDAFLineDenoiseRowFilter: public RawImageSource::CFALineDenoiseRowBlender {
static constexpr int BORDER1 = 1;
static constexpr int BORDER2 = 2;
public:
PDAFLineDenoiseRowFilter(const std::vector<int> &pattern, int offset):
pattern_(pattern),
offset_(offset)
{}
float operator()(int row) const
{
if (!pattern_.empty()) {
int key = (row - offset_) % pattern_.back();
auto it = std::lower_bound(pattern_.begin(), pattern_.end(), key);
int d = *it - key;
if (d <= BORDER2) {
return d <= BORDER1 ? 1.f : 0.5f;
} else if (it > pattern_.begin()) {
d = key - *(it-1);
if (d <= BORDER2) {
return d <= BORDER1 ? 1.f : 0.5f;
}
}
}
return 0.f;
}
private:
std::vector<int> pattern_;
int offset_;
};
} // namespace
@@ -163,6 +196,12 @@ RawImageSource::GreenEqulibrateThreshold &PDAFLinesFilter::greenEqThreshold()
}
std::unique_ptr<RawImageSource::CFALineDenoiseRowBlender> PDAFLinesFilter::lineDenoiseRowBlender()
{
return std::unique_ptr<RawImageSource::CFALineDenoiseRowBlender>(new PDAFLineDenoiseRowFilter(pattern_, offset_));
}
int PDAFLinesFilter::markLine(array2D<float> &rawData, PixelsMap &bpMap, int y)
{
rowmap_.clear();