[vlc-devel] [PATCH 4/4] vhs: add intermediate variable to compute threshold

Alexandre Janniaux ajanni at videolabs.io
Sun Sep 20 18:00:07 CEST 2020


---
 modules/video_filter/vhs.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/modules/video_filter/vhs.c b/modules/video_filter/vhs.c
index 28661d4c58..90ae4b40f2 100644
--- a/modules/video_filter/vhs.c
+++ b/modules/video_filter/vhs.c
@@ -452,10 +452,12 @@ static int vhs_sliding_effect( filter_t *p_filter, picture_t *p_pic_out ) {
         if ( abs( p_sys->i_sliding_speed ) < 5 )
             p_sys->i_sliding_speed += 1;
 
-        /* check if offset is close to 0 and then ready to stop */
-        if ( abs( p_sys->i_sliding_ofs ) < abs( p_sys->i_sliding_speed
+        int threshold = p_sys->i_sliding_speed
              * p_sys->i_height[Y_PLANE]
-             * SEC_FROM_VLC_TICK( p_sys->i_cur_time - p_sys->i_last_time ) )
+             * SEC_FROM_VLC_TICK( p_sys->i_cur_time - p_sys->i_last_time );
+
+        /* check if offset is close to 0 and then ready to stop */
+        if ( abs( p_sys->i_sliding_ofs ) < abs( threshold )
              || abs( p_sys->i_sliding_ofs ) < p_sys->i_height[Y_PLANE] * 100 / 20 ) {
 
             /* reset sliding parameters */
-- 
2.28.0



More information about the vlc-devel mailing list