From cba676463d50bc971225ee289ea8610c7f2c3625 Mon Sep 17 00:00:00 2001 From: Jonathan Thomas Date: Sat, 25 Jun 2022 17:42:30 -0500 Subject: [PATCH] Fixing invalid frame mapping calculation (when using a linear algorithm to map framerates). We were accidentally adding `+1` to the video_length, causing a slight rounding error, causing some random frames to be skipped. For example, if a video with 100 frames was mapped to the same framerate, we would calculate the frame increment: 101 / 100 (instead of 100 / 100). In this simple example, the value increment should be 1.0, matching the source frames exactly. --- src/FrameMapper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FrameMapper.cpp b/src/FrameMapper.cpp index cd17dccb..a15e29dc 100644 --- a/src/FrameMapper.cpp +++ b/src/FrameMapper.cpp @@ -219,7 +219,7 @@ void FrameMapper::Init() int64_t new_length = reader->info.video_length * rate_diff; // Calculate the value difference - double value_increment = (reader->info.video_length + 1) / (double) (new_length); + double value_increment = reader->info.video_length / (double) (new_length); // Loop through curve, and build list of frames double original_frame_num = 1.0f;