From bee90c3febdedc0dae3ea9a2b0179b694ec42ce9 Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Thu, 8 Sep 2011 14:43:23 +0200 Subject: [PATCH] renamed limit to clamp --- decode.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/decode.c b/decode.c index 940159b..6671a69 100644 --- a/decode.c +++ b/decode.c @@ -22,7 +22,7 @@ int64_t gcd(int64_t a, int64_t b) return b; } -float flimitf(float min, float max, float x) +float fclampf(float x, float min, float max) { float tmp = x < min ? min : x; return tmp > max ? max : tmp; @@ -183,8 +183,8 @@ int main(int argc, char **argv) do_ddc(dat_ddc, dat_amp, dat_q); } - float cnt_freq = flimitf(1100.0, 1300.0, 1200.0 + cargf(cnt_q[out] * conjf(cnt_last)) / (2.0 * M_PI * dstep)); - float dat_freq = flimitf(1500.0, 2300.0, 1900.0 + cargf(dat_q[out] * conjf(dat_last)) / (2.0 * M_PI * dstep)); + float cnt_freq = fclampf(1200.0 + cargf(cnt_q[out] * conjf(cnt_last)) / (2.0 * M_PI * dstep), 1100.0, 1300.0); + float dat_freq = fclampf(1900.0 + cargf(dat_q[out] * conjf(dat_last)) / (2.0 * M_PI * dstep), 1500.0, 2300.0); cnt_last = cnt_q[out]; dat_last = dat_q[out]; @@ -384,10 +384,10 @@ int main(int argc, char **argv) // TODO: need better way to compensate for pulse decay time float fixme = 0.0007; if (y_pixel_x < y_width && hor_ticks >= (int)((fixme + sync_porch_len) * drate)) - y_pixel[y_pixel_x++ + (y % 2) * y_width] = flimitf(0.0, 255.0, 255.0 * (dat_freq - 1500.0) / 800.0); + y_pixel[y_pixel_x++ + (y % 2) * y_width] = fclampf(255.0 * (dat_freq - 1500.0) / 800.0, 0.0, 255.0); if (uv_pixel_x < uv_width && hor_ticks >= (int)((fixme + sync_porch_len + y_len + seperator_len + porch_len) * drate)) - uv_pixel[uv_pixel_x++ + odd * uv_width] = flimitf(0.0, 255.0, 255.0 * (dat_freq - 1500.0) / 800.0); + uv_pixel[uv_pixel_x++ + odd * uv_width] = fclampf(255.0 * (dat_freq - 1500.0) / 800.0, 0.0, 255.0); } if (pixel) {