[vlc] Resizing with and without swscale

Patrice Bouchand pbfwdlist at gmail.com
Wed Sep 16 08:34:16 CEST 2009


Thanks for your answer,

About the resizing problem without libswscale,I have looked into the
code and discover that i420_rgb.c module is not selected when
p_filter->fmt_out.video.i_width or p_filter->fmt_out.video.i_height
are odd. Then I have modified xcommon.c to increase
p_filter->fmt_out.video.i_width or p_filter->fmt_out to the upper non
odd value. It makes resizing work all the times, even if the
dimensions are not exactly the one requested, which is not a problem
for my use.

Would you be kind enough to have a look to my patch and let me know if
I'm doing something totally wrong ?

Best regards.

         Patrice

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
diff -pruN vlc-1.0.0-Ori/modules/video_output/x11/xcommon.c
vlc-1.0.0-Mod/modules/video_output/x11/xcommon.c
--- vlc-1.0.0-Ori/modules/video_output/x11/xcommon.c    2009-06-25
12:20:31.000000000 +0200
+++ vlc-1.0.0-Mod/modules/video_output/x11/xcommon.c    2009-09-15
16:04:08.000000000 +0200
@@ -876,9 +876,23 @@ static int InitVideo( vout_thread_t *p_v
     p_vout->output.i_width = p_vout->fmt_out.i_width =
         p_vout->fmt_out.i_visible_width * p_vout->fmt_in.i_width /
         p_vout->fmt_in.i_visible_width;
+
+    if ( p_vout->output.i_width & 1 )
+           {
+           p_vout->output.i_width ++;
+           p_vout->fmt_out.i_width = p_vout->output.i_width;
+           }
+
     p_vout->output.i_height = p_vout->fmt_out.i_height =
         p_vout->fmt_out.i_visible_height * p_vout->fmt_in.i_height /
         p_vout->fmt_in.i_visible_height;
+
+    if ( p_vout->output.i_height & 1 )
+          {
+          p_vout->output.i_height ++;
+          p_vout->fmt_out.i_height = p_vout->output.i_height;
+          }
+
     p_vout->fmt_out.i_x_offset =
         p_vout->fmt_out.i_visible_width * p_vout->fmt_in.i_x_offset /
         p_vout->fmt_in.i_visible_width;
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------






> Le mardi 8 septembre 2009 14:51:10 Patrice Bouchand, vous avez écrit :
>> So, what can I do to:
>> * Have the right colors with libswscale support and reduce cpu consumption
>> ?
>> * Make the resizing work with any values without libswscale, as in vlc
>> 0.8.6 ?
>
> IIRC, 0.8.6 used FFmpeg/libimgresample instead, which has been replaced by
> FFmpeg/libswscale anyway. We removed the plugin because it was buggy on top of
> that.
>
> Hence I doubt the second option is feasible, unless you want to fully
> implement your own optimized scaling algorithm.
>
> --
> Rémi Denis-Courmont
> http://www.remlab.net/
>



More information about the vlc mailing list