mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-20 00:32:11 +08:00
IFE: fix gamma delta (#33897)
update gtab Co-authored-by: Comma Device <device@comma.ai>
This commit is contained in:
@@ -126,8 +126,8 @@ AR0231::AR0231() {
|
||||
0x00000fbc, 0x000000bb, 0x00000009,
|
||||
0x00000fb6, 0x00000fe0, 0x000000ea,
|
||||
};
|
||||
for (int i = 0; i < 64; i++) {
|
||||
float fx = i / 63.0;
|
||||
for (int i = 0; i < 65; i++) {
|
||||
float fx = i / 64.0;
|
||||
const float gamma_k = 0.75;
|
||||
const float gamma_b = 0.125;
|
||||
const float mp = 0.01; // ideally midpoint should be adaptive
|
||||
@@ -138,6 +138,7 @@ AR0231::AR0231() {
|
||||
((rk * (fx-mp) * (gamma_k*mp+gamma_b) * (1+1/(rk*mp)) / (1-rk*(fx-mp))) + gamma_k*mp + gamma_b);
|
||||
gamma_lut_rgb.push_back((uint32_t)(fx*1023.0 + 0.5));
|
||||
}
|
||||
prepare_gamma_lut();
|
||||
linearization_lut = {
|
||||
0x02000000, 0x02000000, 0x02000000, 0x02000000,
|
||||
0x020007ff, 0x020007ff, 0x020007ff, 0x020007ff,
|
||||
|
||||
@@ -68,10 +68,11 @@ OS04C10::OS04C10() {
|
||||
0x00000fa7, 0x000000d9, 0x00001000,
|
||||
0x00000fca, 0x00000fef, 0x000000c7,
|
||||
};
|
||||
for (int i = 0; i < 64; i++) {
|
||||
float fx = i / 63.0;
|
||||
for (int i = 0; i < 65; i++) {
|
||||
float fx = i / 64.0;
|
||||
gamma_lut_rgb.push_back((uint32_t)(pow(fx, 0.7)*1023.0 + 0.5));
|
||||
}
|
||||
prepare_gamma_lut();
|
||||
linearization_lut = {
|
||||
0x02000000, 0x02000000, 0x02000000, 0x02000000,
|
||||
0x020007ff, 0x020007ff, 0x020007ff, 0x020007ff,
|
||||
|
||||
@@ -70,11 +70,12 @@ OX03C10::OX03C10() {
|
||||
0x00000fcc, 0x000000b9, 0x00000ffb,
|
||||
0x00000fc2, 0x00000ff6, 0x000000c9,
|
||||
};
|
||||
for (int i = 0; i < 64; i++) {
|
||||
float fx = i / 63.0;
|
||||
for (int i = 0; i < 65; i++) {
|
||||
float fx = i / 64.0;
|
||||
fx = -0.507089*exp(-12.54124638*fx) + 0.9655*pow(fx, 0.5) - 0.472597*fx + 0.507089;
|
||||
gamma_lut_rgb.push_back((uint32_t)(fx*1023.0 + 0.5));
|
||||
}
|
||||
prepare_gamma_lut();
|
||||
linearization_lut = {
|
||||
0x00200000, 0x00200000, 0x00200000, 0x00200000,
|
||||
0x00404080, 0x00404080, 0x00404080, 0x00404080,
|
||||
|
||||
@@ -72,6 +72,12 @@ public:
|
||||
uint32_t black_level;
|
||||
std::vector<uint32_t> color_correct_matrix; // 3x3
|
||||
std::vector<uint32_t> gamma_lut_rgb; // gamma LUTs are length 64 * sizeof(uint32_t); same for r/g/b here
|
||||
void prepare_gamma_lut() {
|
||||
for (int i = 0; i < 64; i++) {
|
||||
gamma_lut_rgb[i] |= ((uint32_t)(gamma_lut_rgb[i+1] - gamma_lut_rgb[i]) << 10);
|
||||
}
|
||||
gamma_lut_rgb.pop_back();
|
||||
}
|
||||
std::vector<uint32_t> linearization_lut; // length 288
|
||||
std::vector<uint32_t> linearization_pts; // length 4
|
||||
std::vector<uint32_t> vignetting_lut; // 2x length 884
|
||||
|
||||
Reference in New Issue
Block a user