Skip to content

Commit

Permalink
Quick fix for precision issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdawkins committed Oct 7, 2022
1 parent c84daed commit 662cc40
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sprokit/processes/core/downsample_process.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,12 @@ ::make_config()
int downsample_process::priv
::target_frame_count( double time_seconds )
{
return static_cast< int >( std::floor( time_seconds * target_frame_rate_ + 1e-10 ) );
// 1e-6 constant is a quick hack because the time value reported by
// kwiver timestamps is only valid up to microsecond precision and
// floating point arithmetic using this lack of precision for the
// below equation leads to some ill-defined behaviour when attempting
// to downsample to the target frame rate without this usec addition
return static_cast< int >( std::floor( ( time_seconds + 1e-6 ) * target_frame_rate_ ) );
}

sprokit::datum_t downsample_process::priv
Expand Down

0 comments on commit 662cc40

Please sign in to comment.