[vlc-commits] rotate: don't branch inside spinlock

Pierre Ynard git at videolan.org
Thu Oct 18 04:22:43 CEST 2012


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Thu Oct 18 04:22:02 2012 +0200| [aaf4cc0e9b457f762a488f4051bd7a3895c5d084] | committer: Pierre Ynard

rotate: don't branch inside spinlock

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

 modules/video_filter/rotate.c |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/modules/video_filter/rotate.c b/modules/video_filter/rotate.c
index 6c8dfbe..b144685 100644
--- a/modules/video_filter/rotate.c
+++ b/modules/video_filter/rotate.c
@@ -209,6 +209,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         return NULL;
     }
 
+    int s, c;
     if( p_sys->p_motion != NULL )
     {
         int i_angle = motion_get_angle( p_sys->p_motion ) / 2;
@@ -217,15 +218,20 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
             p_sys->i_angle = i_angle;
             cache_trigo( i_angle, &p_sys->i_sin, &p_sys->i_cos );
         }
+
+        s = p_sys->i_sin;
+        c = p_sys->i_cos;
     }
     else
+    {
         vlc_spin_lock( &p_sys->lock );
-
-    const int i_sin = p_sys->i_sin;
-    const int i_cos = p_sys->i_cos;
-
-    if( p_sys->p_motion == NULL )
+        s = p_sys->i_sin;
+        c = p_sys->i_cos;
         vlc_spin_unlock( &p_sys->lock );
+    }
+
+    const int i_sin = s;
+    const int i_cos = c;
 
     for( int i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
     {



More information about the vlc-commits mailing list