swap palette on big endian

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22246 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
michael 2007-02-17 12:58:35 +00:00
parent 8fd50571b0
commit 28f35b52f6
1 changed files with 13 additions and 2 deletions

View File

@ -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);
}
}