* ./plugins/filter/deinterlace.c: fixed the green bottom line in the
authorSam Hocevar <sam@videolan.org>
Fri, 11 Oct 2002 21:17:29 +0000 (21:17 +0000)
committerSam Hocevar <sam@videolan.org>
Fri, 11 Oct 2002 21:17:29 +0000 (21:17 +0000)
    linear deinterlace mode, thanks to Marian Durkovic <md@bts.sk>.

modules/video_filter/deinterlace/deinterlace.c

index 8c7d5ea..9f82ba9 100644 (file)
@@ -2,7 +2,7 @@
  * deinterlace.c : deinterlacer plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
  * deinterlace.c : deinterlacer plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: deinterlace.c,v 1.2 2002/08/26 09:12:46 sam Exp $
+ * $Id: deinterlace.c,v 1.3 2002/10/11 21:17:29 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -450,22 +450,21 @@ static void RenderLinear( vout_thread_t *p_vout,
     {
         u8 *p_in, *p_out_end, *p_out;
 
     {
         u8 *p_in, *p_out_end, *p_out;
 
-        p_in = p_pic->p[i_plane].p_pixels
-                   + i_field * p_pic->p[i_plane].i_pitch;
-
+        p_in = p_pic->p[i_plane].p_pixels;
         p_out = p_outpic->p[i_plane].p_pixels;
         p_out_end = p_out + p_outpic->p[i_plane].i_pitch
                              * p_outpic->p[i_plane].i_lines;
 
         p_out = p_outpic->p[i_plane].p_pixels;
         p_out_end = p_out + p_outpic->p[i_plane].i_pitch
                              * p_outpic->p[i_plane].i_lines;
 
-        if( i_field == 0 )
+        /* For BOTTOM field we need to add the first line */
+        if( i_field == 1 )
         {
             p_vout->p_vlc->pf_memcpy( p_out, p_in,
                                       p_pic->p[i_plane].i_pitch );
         {
             p_vout->p_vlc->pf_memcpy( p_out, p_in,
                                       p_pic->p[i_plane].i_pitch );
-            p_in += 2 * p_pic->p[i_plane].i_pitch;
+            p_in += p_pic->p[i_plane].i_pitch;
             p_out += p_pic->p[i_plane].i_pitch;
         }
 
             p_out += p_pic->p[i_plane].i_pitch;
         }
 
-        p_out_end -= p_outpic->p[i_plane].i_pitch;
+        p_out_end -= 2 * p_outpic->p[i_plane].i_pitch;
 
         for( ; p_out < p_out_end ; )
         {
 
         for( ; p_out < p_out_end ; )
         {
@@ -481,14 +480,17 @@ static void RenderLinear( vout_thread_t *p_vout,
             p_out += p_pic->p[i_plane].i_pitch;
         }
 
             p_out += p_pic->p[i_plane].i_pitch;
         }
 
-#if 0
+        p_vout->p_vlc->pf_memcpy( p_out, p_in,
+                                  p_pic->p[i_plane].i_pitch );
+
+        /* For TOP field we need to add the last line */
         if( i_field == 0 )
         {
         if( i_field == 0 )
         {
-            p_in -= 2 * p_pic->p[i_plane].i_pitch;
+            p_in += p_pic->p[i_plane].i_pitch;
+            p_out += p_pic->p[i_plane].i_pitch;
             p_vout->p_vlc->pf_memcpy( p_out, p_in,
                                       p_pic->p[i_plane].i_pitch );
         }
             p_vout->p_vlc->pf_memcpy( p_out, p_in,
                                       p_pic->p[i_plane].i_pitch );
         }
-#endif
     }
 }
 
     }
 }