diff options
Diffstat (limited to 'libmpcodecs/vf.c')
-rw-r--r-- | libmpcodecs/vf.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libmpcodecs/vf.c b/libmpcodecs/vf.c index bb7d57b9a2..902b64e810 100644 --- a/libmpcodecs/vf.c +++ b/libmpcodecs/vf.c @@ -217,12 +217,19 @@ void vf_mpi_clear(mp_image_t* mpi,int x0,int y0,int w,int h){ unsigned int* p=(unsigned int*) dst; int size=(mpi->bpp>>3)*w/4; int i; +#ifdef WORDS_BIGENDIAN +#define CLEAR_PACKEDYUV_PATTERN 0x00800080 +#define CLEAR_PACKEDYUV_PATTERN_SWAPPED 0x80008000 +#else +#define CLEAR_PACKEDYUV_PATTERN 0x80008000 +#define CLEAR_PACKEDYUV_PATTERN_SWAPPED 0x00800080 +#endif if(mpi->flags&MP_IMGFLAG_SWAPPED){ - for(i=0;i<size;i+=4) p[i]=p[i+1]=p[i+2]=p[i+3]=0x00800080; - for(;i<size;i++) p[i]=0x00800080; + for(i=0;i<size-3;i+=4) p[i]=p[i+1]=p[i+2]=p[i+3]=CLEAR_PACKEDYUV_PATTERN_SWAPPED; + for(;i<size;i++) p[i]=CLEAR_PACKEDYUV_PATTERN_SWAPPED; } else { - for(i=0;i<size;i+=4) p[i]=p[i+1]=p[i+2]=p[i+3]=0x80008000; - for(;i<size;i++) p[i]=0x80008000; + for(i=0;i<size-3;i+=4) p[i]=p[i+1]=p[i+2]=p[i+3]=CLEAR_PACKEDYUV_PATTERN; + for(;i<size;i++) p[i]=CLEAR_PACKEDYUV_PATTERN; } } else memset(dst,0,(mpi->bpp>>3)*w); |