diff --git a/libmpcodecs/vf_scale.c b/libmpcodecs/vf_scale.c index bbfbd4662e..445564e89b 100644 --- a/libmpcodecs/vf_scale.c +++ b/libmpcodecs/vf_scale.c @@ -11,6 +11,7 @@ #include "mp_image.h" #include "vf.h" #include "fmt-conversion.h" +#include "bswap.h" #include "libvo/fastmemcpy.h" #include "libswscale/swscale.h" @@ -323,9 +324,19 @@ static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi){ static void scale(struct SwsContext *sws1, struct SwsContext *sws2, uint8_t *src[3], int src_stride[3], int y, int h, uint8_t *dst[3], int dst_stride[3], int interlaced){ + uint8_t *src2[3]={src[0], src[1], src[2]}; +#ifdef WORDS_BIGENDIAN + uint32_t pal2[256]; + if (src[1] && !src[2]){ + int i; + for(i=0; i<256; i++) + pal2[i]= bswap_32(((uint32_t*)src[1])[i]); + src2[1]= pal2; + } +#endif + if(interlaced){ int i; - uint8_t *src2[3]={src[0], src[1], src[2]}; uint8_t *dst2[3]={dst[0], dst[1], dst[2]}; int src_stride2[3]={2*src_stride[0], 2*src_stride[1], 2*src_stride[2]}; int dst_stride2[3]={2*dst_stride[0], 2*dst_stride[1], 2*dst_stride[2]}; @@ -337,7 +348,7 @@ static void scale(struct SwsContext *sws1, struct SwsContext *sws2, uint8_t *src } sws_scale_ordered(sws2, src2, src_stride2, y>>1, h>>1, dst2, dst_stride2); }else{ - sws_scale_ordered(sws1, src, src_stride, y, h, dst, dst_stride); + sws_scale_ordered(sws1, src2, src_stride, y, h, dst, dst_stride); } }