comparison libmpcodecs/vf_scale.c @ 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
comparison
equal deleted inserted replaced
30115:ad61464d02a7 30116:f2d9ce0a6b28
329 vf->priv->w, vf->priv->h); 329 vf->priv->w, vf->priv->h);
330 } 330 }
331 331
332 static void scale(struct SwsContext *sws1, struct SwsContext *sws2, uint8_t *src[MP_MAX_PLANES], int src_stride[MP_MAX_PLANES], 332 static void scale(struct SwsContext *sws1, struct SwsContext *sws2, uint8_t *src[MP_MAX_PLANES], int src_stride[MP_MAX_PLANES],
333 int y, int h, uint8_t *dst[MP_MAX_PLANES], int dst_stride[MP_MAX_PLANES], int interlaced){ 333 int y, int h, uint8_t *dst[MP_MAX_PLANES], int dst_stride[MP_MAX_PLANES], int interlaced){
334 uint8_t *src2[MP_MAX_PLANES]={src[0], src[1], src[2]}; 334 uint8_t *src2[MP_MAX_PLANES]={src[0], src[1], src[2], src[3]};
335 #if HAVE_BIGENDIAN 335 #if HAVE_BIGENDIAN
336 uint32_t pal2[256]; 336 uint32_t pal2[256];
337 if (src[1] && !src[2]){ 337 if (src[1] && !src[2]){
338 int i; 338 int i;
339 for(i=0; i<256; i++) 339 for(i=0; i<256; i++)
342 } 342 }
343 #endif 343 #endif
344 344
345 if(interlaced){ 345 if(interlaced){
346 int i; 346 int i;
347 uint8_t *dst2[MP_MAX_PLANES]={dst[0], dst[1], dst[2]}; 347 uint8_t *dst2[MP_MAX_PLANES]={dst[0], dst[1], dst[2], dst[3]};
348 int src_stride2[MP_MAX_PLANES]={2*src_stride[0], 2*src_stride[1], 2*src_stride[2]}; 348 int src_stride2[MP_MAX_PLANES]={2*src_stride[0], 2*src_stride[1], 2*src_stride[2], 2*src_stride[3]};
349 int dst_stride2[MP_MAX_PLANES]={2*dst_stride[0], 2*dst_stride[1], 2*dst_stride[2]}; 349 int dst_stride2[MP_MAX_PLANES]={2*dst_stride[0], 2*dst_stride[1], 2*dst_stride[2], 2*dst_stride[3]};
350 350
351 sws_scale_ordered(sws1, src2, src_stride2, y>>1, h>>1, dst2, dst_stride2); 351 sws_scale_ordered(sws1, src2, src_stride2, y>>1, h>>1, dst2, dst_stride2);
352 for(i=0; i<3; i++){ 352 for(i=0; i<3; i++){
353 src2[i] += src_stride[i]; 353 src2[i] += src_stride[i];
354 dst2[i] += dst_stride[i]; 354 dst2[i] += dst_stride[i];