[vlc-devel] [PATCH] video_chroma/scscale: use preprocessor instead of runtime check

Filip Roséen filip at atch.se
Wed Mar 15 10:07:55 CET 2017


The equivalent result will probably be achieved by the compilers
optimizer, but having the intent declared to begin with certainly does
not hurt.
---
 modules/video_chroma/swscale.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/modules/video_chroma/swscale.c b/modules/video_chroma/swscale.c
index 8993d11ec5..fbac51abdd 100644
--- a/modules/video_chroma/swscale.c
+++ b/modules/video_chroma/swscale.c
@@ -132,8 +132,8 @@ static int GetParameters( ScalerConfiguration *,
 static int GetSwsCpuMask(void);
 
 /* SwScaler point resize quality seems really bad, let our scale module do it
- * (change it to true to try) */
-#define ALLOW_YUVP (false)
+ * (change it to 1 to try) */
+#define ALLOW_YUVP 0
 /* SwScaler does not like too small picture */
 #define MINIMUM_WIDTH (32)
 
@@ -305,14 +305,14 @@ static int GetParameters( ScalerConfiguration *p_cfg,
     GetFfmpegChroma( &i_fmti, p_fmti );
     GetFfmpegChroma( &i_fmto, p_fmto );
 
-    if( p_fmti->i_chroma == p_fmto->i_chroma )
+#if ALLOW_YUVP
+    if( p_fmti->i_chroma == p_fmto->i_chroma &&
+        p_fmti->i_chroma == VLC_CODEC_YUVP )
     {
-        if( p_fmti->i_chroma == VLC_CODEC_YUVP && ALLOW_YUVP )
-        {
-            i_fmti = i_fmto = AV_PIX_FMT_GRAY8;
-            i_sws_flags = SWS_POINT;
-        }
+        i_fmti = i_fmto = AV_PIX_FMT_GRAY8;
+        i_sws_flags = SWS_POINT;
     }
+#endif
 
     FixParameters( &i_fmti, &b_has_ai, &b_swap_uvi, p_fmti->i_chroma );
     FixParameters( &i_fmto, &b_has_ao, &b_swap_uvo, p_fmto->i_chroma );
-- 
2.12.0


More information about the vlc-devel mailing list