]> git.sesse.net Git - vlc/blobdiff - modules/video_chroma/i420_rgb8.c
Copyright fixes
[vlc] / modules / video_chroma / i420_rgb8.c
index ce2e0d5f5a31e2f9b0f5d6ca430ab8b3d46aae2f..6939f5dc535e07076513686a03a37a244df826e3 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************
  * i420_rgb8.c : YUV to bitmap RGB conversion module for vlc
  *****************************************************************************
- * Copyright (C) 2000 VideoLAN
- * $Id: i420_rgb8.c,v 1.2 2002/11/20 13:37:36 sam Exp $
+ * Copyright (C) 2000 VideoLAN (Centrale Réseaux) and its contributors
+ * $Id$
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -41,10 +41,10 @@ static void SetOffset( int, int, int, int, vlc_bool_t *, int *, int * );
 void E_(I420_RGB8)( vout_thread_t *p_vout, picture_t *p_src, picture_t *p_dest )
 {
     /* We got this one from the old arguments */
-    u8 *p_pic = (u8*)p_dest->p->p_pixels;
-    u8 *p_y   = p_src->Y_PIXELS;
-    u8 *p_u   = p_src->U_PIXELS;
-    u8 *p_v   = p_src->V_PIXELS;
+    uint8_t *p_pic = (uint8_t*)p_dest->p->p_pixels;
+    uint8_t *p_y   = p_src->Y_PIXELS;
+    uint8_t *p_u   = p_src->U_PIXELS;
+    uint8_t *p_v   = p_src->V_PIXELS;
 
     vlc_bool_t  b_hscale;                         /* horizontal scaling type */
     unsigned int i_vscale;                          /* vertical scaling type */
@@ -55,12 +55,17 @@ void E_(I420_RGB8)( vout_thread_t *p_vout, picture_t *p_src, picture_t *p_dest )
     unsigned int i_chroma_width = p_vout->render.i_width / 2;/* chroma width */
 
     /* Lookup table */
-    u8 *        p_lookup = p_vout->chroma.p_sys->p_base;
+    uint8_t *        p_lookup = p_vout->chroma.p_sys->p_base;
 
     /* Offset array pointer */
     int *       p_offset_start = p_vout->chroma.p_sys->p_offset;
     int *       p_offset;
 
+    const int i_source_margin = p_src->p[0].i_pitch
+                                 - p_src->p[0].i_visible_pitch;
+    const int i_source_margin_c = p_src->p[1].i_pitch
+                                 - p_src->p[1].i_visible_pitch;
+
     /* The dithering matrices */
     static int dither10[4] = {  0x0,  0x8,  0x2,  0xa };
     static int dither11[4] = {  0xc,  0x4,  0xe,  0x6 };
@@ -89,6 +94,13 @@ void E_(I420_RGB8)( vout_thread_t *p_vout, picture_t *p_src, picture_t *p_dest )
         SCALE_WIDTH_DITHER( 420 );
         SCALE_HEIGHT_DITHER( 420 );
     }
+
+    p_y += i_source_margin;
+    if( i_y % 2 )
+    {
+        p_u += i_source_margin_c;
+        p_v += i_source_margin_c;
+    }
 }
 
 /* Following functions are local */