[vlc-commits] vhs: add intermediate variable to compute threshold

Alexandre Janniaux git at videolan.org
Mon Oct 5 20:45:22 CEST 2020


vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Sun Sep 20 18:00:07 2020 +0200| [31036ea4c207387ef1e4d5e41409d7ff571d2b12] | committer: Alexandre Janniaux

vhs: add intermediate variable to compute threshold

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=31036ea4c207387ef1e4d5e41409d7ff571d2b12
---

 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 */



More information about the vlc-commits mailing list