genesys: Don't use variants of M_PI that aren't guaranteed to be present

merge-requests/215/head
Povilas Kanapickas 2019-10-13 06:18:49 +03:00
rodzic a694002364
commit 59e356ac13
2 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -203,7 +203,7 @@ void genesys_deskew(Genesys_Scanner *s, const Genesys_Sensor& sensor)
sensor.optical_res, sensor.optical_res,
&x, &y, &slope));
DBG(DBG_info, "%s: slope=%f => %f\n",__func__,slope, (slope/M_PI_2)*90);
DBG(DBG_info, "%s: slope=%f => %f\n", __func__, slope, slope * 180 / M_PI);
// rotate image slope is in [-PI/2,PI/2]. Positive values rotate trigonometric direction wise
TIE(sanei_magic_rotate(&s->params, dev->img_buffer.data(),

Wyświetl plik

@ -2421,7 +2421,8 @@ void sanei_genesys_load_lut(unsigned char* lut,
* then take the tangent (T.O.A)
* then multiply by the normal linear slope
* because the table may not be square, i.e. 1024x256*/
rise = std::tan(static_cast<double>(slope) / 128 * M_PI_4 + M_PI_4) * max_out_val / max_in_val;
auto pi_4 = M_PI / 4.0;
rise = std::tan(static_cast<double>(slope) / 128 * pi_4 + pi_4) * max_out_val / max_in_val;
/* line must stay vertically centered, so figure
* out vertical offset at central input value */