From 9e021b0b0b4a4fce61a65cc821865b9452884a3a Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Thu, 13 Jul 2023 15:09:55 +0200 Subject: [PATCH 1/2] fix the stepping --- source/blender/editors/animation/keyframes_general.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/animation/keyframes_general.cc b/source/blender/editors/animation/keyframes_general.cc index dc5ec85806a..403d5eccfc6 100644 --- a/source/blender/editors/animation/keyframes_general.cc +++ b/source/blender/editors/animation/keyframes_general.cc @@ -557,7 +557,7 @@ void butterworth_smooth_fcurve_segment(FCurve *fcu, } const float x_delta = fcu->bezt[i].vec[1][0] - left_bezt.vec[1][0] + filter_order; - const int filter_index = (int)(x_delta * sample_rate); + const int filter_index = round(x_delta * sample_rate); const float blend_value = butterworth_calculate_blend_value(samples, filtered_values, samples_start_index, -- 2.30.2 From c22122c333c17269ec15d45c1f0c24a7fa85fd1d Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Thu, 13 Jul 2023 15:46:58 +0200 Subject: [PATCH 2/2] add comment --- source/blender/editors/animation/keyframes_general.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/blender/editors/animation/keyframes_general.cc b/source/blender/editors/animation/keyframes_general.cc index f63d2a5a1a3..2ecfc5bd03e 100644 --- a/source/blender/editors/animation/keyframes_general.cc +++ b/source/blender/editors/animation/keyframes_general.cc @@ -557,6 +557,8 @@ void butterworth_smooth_fcurve_segment(FCurve *fcu, } const float x_delta = fcu->bezt[i].vec[1][0] - left_bezt.vec[1][0] + filter_order; + /* Using round() instead of casting to int. Casting would introduce a stepping issue when the + * x-value is just below a full frame. */ const int filter_index = round(x_delta * sample_rate); const float blend_value = butterworth_calculate_blend_value(samples, filtered_values, -- 2.30.2