qv4l2/v4l2-ctl: fix rounding error in field-per-second calculation
authorHans Verkuil <hans.verkuil@cisco.com>
Wed, 20 Mar 2013 17:59:31 +0000 (18:59 +0100)
committerHans Verkuil <hans.verkuil@cisco.com>
Wed, 20 Mar 2013 17:59:31 +0000 (18:59 +0100)
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 <hans.verkuil@cisco.com>
utils/qv4l2/general-tab.cpp
utils/v4l2-ctl/v4l2-ctl-stds.cpp

index 47b5987..615e40c 100644 (file)
@@ -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];
 
index 02e6cca..9ee975f 100644 (file)
@@ -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)