diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2013-03-26 16:57:08 +0100 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@gmail.com> | 2013-03-26 16:58:28 +0100 |
commit | 617a46bff0cda0a30e30e5173f1666b2338bff25 (patch) | |
tree | ce811f1ff949df7549172259c2f5f41b493c01e2 /plugins/pco | |
parent | 74a9ae132fa56271ec593ac716fce09ff83bb5e4 (diff) | |
download | libuca-617a46bff0cda0a30e30e5173f1666b2338bff25.tar.gz libuca-617a46bff0cda0a30e30e5173f1666b2338bff25.tar.bz2 libuca-617a46bff0cda0a30e30e5173f1666b2338bff25.tar.xz libuca-617a46bff0cda0a30e30e5173f1666b2338bff25.zip |
Fix clock skew when setting the frame rate
This is a highly dubious patch, because we use a different delay time as what
the manual says it is supposed to be.
Diffstat (limited to 'plugins/pco')
-rw-r--r-- | plugins/pco/uca-pco-camera.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/plugins/pco/uca-pco-camera.c b/plugins/pco/uca-pco-camera.c index 4a0cce6..3eee186 100644 --- a/plugins/pco/uca-pco-camera.c +++ b/plugins/pco/uca-pco-camera.c @@ -320,14 +320,22 @@ read_timebase(UcaPcoCameraPrivate *priv) pco_get_timebase(priv->pco, &priv->delay_timebase, &priv->exposure_timebase); } +static gboolean +check_timebase (gdouble time, gdouble scale) +{ + const gdouble EPSILON = 1e-3; + gdouble scaled = time * scale; + return scaled >= 1.0 && (scaled - ((int) scaled)) < EPSILON; +} + static gdouble get_suitable_timebase(gdouble time) { - if (time * 1e3 >= 1.0) + if (check_timebase (time, 1e3)) return TIMEBASE_MS; - if (time * 1e6 >= 1.0) + if (check_timebase (time, 1e6)) return TIMEBASE_US; - if (time * 1e9 >= 1.0) + if (check_timebase (time, 1e9)) return TIMEBASE_NS; return TIMEBASE_INVALID; } @@ -336,13 +344,13 @@ static gdouble get_internal_delay (UcaPcoCamera *camera) { if (camera->priv->description->type == CAMERATYPE_PCO_DIMAX_STD) { - gdouble sensor_rate; + guint sensor_rate; g_object_get (camera, "sensor-pixelrate", &sensor_rate, NULL); if (sensor_rate == 55000000.0) return 0.000079; else if (sensor_rate == 62500000.0) - return 0.000069; + return 0.000036; } return 0.0; @@ -688,6 +696,7 @@ uca_pco_camera_set_property(GObject *object, guint property_id, const GValue *va gdouble timebase = convert_timebase(suitable_timebase); guint32 timesteps = time / timebase; + err = pco_set_exposure_time(priv->pco, timesteps); } } |