-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathAAF.cpp
More file actions
28 lines (25 loc) · 745 Bytes
/
Copy pathAAF.cpp
File metadata and controls
28 lines (25 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "MyISP.h"
#include <math.h>
// RAW data processing
// anti-aliasing filter
void AAF(ImageRaw& raw)
{
ImageRaw* raw_pad = new ImageRaw(raw);
raw_pad->padding(2, PADDING_MODE_REFLECT);
for (int y = 0; y < raw_pad->getHeight() - 4; y++) {
for (int x = 0; x < raw_pad->getWidth() - 4; x++) {
uint16_t p0, p1, p2, p3, p4, p5, p6, p7, p8;
p0 = raw_pad->at(y + 2, x + 2);
p1 = raw_pad->at(y, x);
p2 = raw_pad->at(y, x + 2);
p3 = raw_pad->at(y, x + 4);
p4 = raw_pad->at(y + 2, x);
p5 = raw_pad->at(y + 2, x + 4);
p6 = raw_pad->at(y + 4, x);
p7 = raw_pad->at(y + 4, x + 2);
p8 = raw_pad->at(y + 4, x + 4);
raw.at(y, x) = (p0 * 8 + p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8) / 16.0;
}
}
delete raw_pad;
}