From 16760754aeef0d6fe83ce556389b0e6987669a20 Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Fri, 28 Sep 2012 14:41:26 +0200 Subject: [PATCH] show control frequency in debug picture --- debug.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/debug.c b/debug.c index ea07e71..9518a94 100644 --- a/debug.c +++ b/debug.c @@ -305,14 +305,11 @@ int main(int argc, char **argv) if (hor_ticks < width) { uint8_t *p = img->pixel + 3 * y * width + 3 * hor_ticks; -#if 1 - uint8_t v = fclampf(0.0, 255.0, 255.0 * (dat_freq - 1500.0) / 800.0); -#else - uint8_t v = fclampf(0.0, 255.0, 255.0 * (cnt_freq - 1100.0) / 200.0); -#endif - p[0] = v; - p[1] = v; - p[2] = v; + float dat_v = (dat_freq - 1500.0) / 800.0; + float cnt_v = (1300.0 - cnt_freq) / 200.0; + p[0] = fclampf(0.0, 255.0, 255.0 * dat_v); + p[1] = fclampf(0.0, 255.0, 255.0 * (dat_v + cnt_v)); + p[2] = fclampf(0.0, 255.0, 255.0 * dat_v); } // if horizontal sync is too early, we reset to the beginning instead of ignoring