[vlc-commits] transcode: video: Simplify dimension rounding.
    Hugo Beauzée-Luyssen 
    git at videolan.org
       
    Wed Aug 23 17:39:33 CEST 2017
    
    
  
vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Wed Aug 23 11:16:06 2017 +0200| [756ceff1a862141c436a65b1041775826b55cee8] | committer: Hugo Beauzée-Luyssen
transcode: video: Simplify dimension rounding.
Do not round visible dimensions
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=756ceff1a862141c436a65b1041775826b55cee8
---
 modules/stream_out/transcode/video.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index 778fb00dfd..cadefa28d8 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -522,10 +522,13 @@ static void transcode_video_size_init( sout_stream_t *p_stream,
       * Make sure its multiple of 2
       */
      /* width/height of output stream */
-     int i_dst_visible_width =  2 * lroundf(f_scale_width*i_src_visible_width/2);
-     int i_dst_visible_height = 2 * lroundf(f_scale_height*i_src_visible_height/2);
-     int i_dst_width =  2 * lroundf(f_scale_width*p_fmt_out->video.i_width/2);
-     int i_dst_height = 2 * lroundf(f_scale_height*p_fmt_out->video.i_height/2);
+     int i_dst_visible_width =  lroundf(f_scale_width*i_src_visible_width);
+     int i_dst_visible_height = lroundf(f_scale_height*i_src_visible_height);
+     int i_dst_width =  lroundf(f_scale_width*p_fmt_out->video.i_width);
+     int i_dst_height = lroundf(f_scale_height*p_fmt_out->video.i_height);
+
+     if( i_dst_width & 1 ) ++i_dst_width;
+     if( i_dst_height & 1 ) ++i_dst_height;
 
      /* Store calculated values */
      id->p_encoder->fmt_out.video.i_width = i_dst_width;
    
    
More information about the vlc-commits
mailing list