changeset 30116:f2d9ce0a6b28

Also pass alpha plane to swscale, avoids crashes when converting between YUV with alpha and some other format supporting alpha.
author reimar
date Fri, 01 Jan 2010 01:06:34 +0000
parents ad61464d02a7
children 53e5874c33c3
files libmpcodecs/vf_scale.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vf_scale.c	Thu Dec 31 23:45:07 2009 +0000
+++ b/libmpcodecs/vf_scale.c	Fri Jan 01 01:06:34 2010 +0000
@@ -331,7 +331,7 @@
 
 static void scale(struct SwsContext *sws1, struct SwsContext *sws2, uint8_t *src[MP_MAX_PLANES], int src_stride[MP_MAX_PLANES],
                   int y, int h,  uint8_t *dst[MP_MAX_PLANES], int dst_stride[MP_MAX_PLANES], int interlaced){
-    uint8_t *src2[MP_MAX_PLANES]={src[0], src[1], src[2]};
+    uint8_t *src2[MP_MAX_PLANES]={src[0], src[1], src[2], src[3]};
 #if HAVE_BIGENDIAN
     uint32_t pal2[256];
     if (src[1] && !src[2]){
@@ -344,9 +344,9 @@
 
     if(interlaced){
         int i;
-        uint8_t *dst2[MP_MAX_PLANES]={dst[0], dst[1], dst[2]};
-        int src_stride2[MP_MAX_PLANES]={2*src_stride[0], 2*src_stride[1], 2*src_stride[2]};
-        int dst_stride2[MP_MAX_PLANES]={2*dst_stride[0], 2*dst_stride[1], 2*dst_stride[2]};
+        uint8_t *dst2[MP_MAX_PLANES]={dst[0], dst[1], dst[2], dst[3]};
+        int src_stride2[MP_MAX_PLANES]={2*src_stride[0], 2*src_stride[1], 2*src_stride[2], 2*src_stride[3]};
+        int dst_stride2[MP_MAX_PLANES]={2*dst_stride[0], 2*dst_stride[1], 2*dst_stride[2], 2*dst_stride[3]};
 
         sws_scale_ordered(sws1, src2, src_stride2, y>>1, h>>1, dst2, dst_stride2);
         for(i=0; i<3; i++){