[vlc-devel] [PATCH] swscale: use x and y offsets when rescaling

Felix Abecassis felix.abecassis at gmail.com
Fri Sep 19 21:09:22 CEST 2014


Fix #12085
---
 modules/video_chroma/swscale.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/modules/video_chroma/swscale.c b/modules/video_chroma/swscale.c
index 8ce512c..164a0d5 100644
--- a/modules/video_chroma/swscale.c
+++ b/modules/video_chroma/swscale.c
@@ -504,12 +504,16 @@ static void GetPixels( uint8_t *pp_pixel[4], int pi_pitch[4],
                        bool b_swap_uv )
 {
     assert( !b_swap_uv || i_plane_count >= 3 );
+    const int i_x_offset = p_picture->format.i_x_offset;
+    const int i_y_offset = p_picture->format.i_y_offset;
     int n;
     for( n = 0; n < __MIN(i_plane_count, p_picture->i_planes-i_plane_start ); n++ )
     {
         const int nd = ( b_swap_uv && n >= 1 && n <= 2 ) ? (3 - n) : n;
         pp_pixel[nd] = p_picture->p[i_plane_start+n].p_pixels;
         pi_pitch[nd] = p_picture->p[i_plane_start+n].i_pitch;
+        pp_pixel[nd] += pi_pitch[nd] * i_y_offset
+            + p_picture->p[i_plane_start+n].i_pixel_pitch * i_x_offset;
     }
     for( ; n < 4; n++ )
     {
-- 
1.9.1




More information about the vlc-devel mailing list