From 9ff4dc6128d290634ce005f48ba70b3e312e74d8 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Wed, 20 Mar 2013 18:59:31 +0100 Subject: [PATCH] qv4l2/v4l2-ctl: fix rounding error in field-per-second calculation The total height was divided by 2, since height is odd we should make sure the height is a double, not unsigned or you get a rounding error. Signed-off-by: Hans Verkuil --- utils/qv4l2/general-tab.cpp | 4 ++-- utils/v4l2-ctl/v4l2-ctl-stds.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/qv4l2/general-tab.cpp b/utils/qv4l2/general-tab.cpp index 47b5987..615e40c 100644 --- a/utils/qv4l2/general-tab.cpp +++ b/utils/qv4l2/general-tab.cpp @@ -815,10 +815,10 @@ void GeneralTab::refreshTimings() if (enum_dv_timings(timings, true)) { do { v4l2_bt_timings &bt = timings.timings.bt; - unsigned tot_height = bt.height + + double tot_height = bt.height + bt.vfrontporch + bt.vsync + bt.vbackporch + bt.il_vfrontporch + bt.il_vsync + bt.il_vbackporch; - unsigned tot_width = bt.width + + double tot_width = bt.width + bt.hfrontporch + bt.hsync + bt.hbackporch; char buf[100]; diff --git a/utils/v4l2-ctl/v4l2-ctl-stds.cpp b/utils/v4l2-ctl/v4l2-ctl-stds.cpp index 02e6cca..9ee975f 100644 --- a/utils/v4l2-ctl/v4l2-ctl-stds.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-stds.cpp @@ -260,10 +260,10 @@ static void print_dv_timings(const struct v4l2_dv_timings *t) (bt->polarities & V4L2_DV_HSYNC_POS_POL) ? '+' : '-'); printf("\tPixelclock: %lld Hz", bt->pixelclock); if (bt->width && bt->height) { - unsigned tot_height = bt->height + + double tot_height = bt->height + bt->vfrontporch + bt->vsync + bt->vbackporch + bt->il_vfrontporch + bt->il_vsync + bt->il_vbackporch; - unsigned tot_width = bt->width + + double tot_width = bt->width + bt->hfrontporch + bt->hsync + bt->hbackporch; if (bt->interlaced) -- 2.7.4