forked from bartvdbraak/blender
bugfix #4812
Quicktime reading for Macs: code that converted ARGB to RGBA was endian sensitive. Didn't work for Mac intel systems.
This commit is contained in:
parent
9123507c2e
commit
dba6769b2e
@ -291,6 +291,7 @@ ImBuf * qtime_fetchibuf (struct anim *anim, int position)
|
|||||||
|
|
||||||
ImBuf *ibuf = NULL;
|
ImBuf *ibuf = NULL;
|
||||||
unsigned int *rect;
|
unsigned int *rect;
|
||||||
|
unsigned char *from, *to;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
unsigned char *crect;
|
unsigned char *crect;
|
||||||
#endif
|
#endif
|
||||||
@ -321,11 +322,16 @@ ImBuf * qtime_fetchibuf (struct anim *anim, int position)
|
|||||||
changePos = (uint32_t *) rect; //textureIMBuf *THE* data pointerrr
|
changePos = (uint32_t *) rect; //textureIMBuf *THE* data pointerrr
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
// Swap alpha byte to the end, so ARGB become RGBA; note this is
|
// Swap alpha byte to the end, so ARGB become RGBA;
|
||||||
// big endian-centric.
|
from= (unsigned char *)readPos;
|
||||||
for( index = 0; index < boxsize; index++, changePos++, readPos++ )
|
to= (unsigned char *)changePos;
|
||||||
*( changePos ) = ( ( *readPos & 0xFFFFFF ) << 8 ) |
|
|
||||||
( ( *readPos >> 24 ) & 0xFF );
|
for( index = 0; index < boxsize; index++, from+=4, to+=4 ) {
|
||||||
|
to[3] = from[0];
|
||||||
|
to[0] = from[1];
|
||||||
|
to[1] = from[2];
|
||||||
|
to[2] = from[3];
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -581,6 +587,7 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags)
|
|||||||
|
|
||||||
ImBuf *wbuf = NULL;
|
ImBuf *wbuf = NULL;
|
||||||
unsigned int *rect;
|
unsigned int *rect;
|
||||||
|
unsigned char *from, *to;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (mem == NULL)
|
if (mem == NULL)
|
||||||
@ -678,9 +685,16 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags)
|
|||||||
readPos = (uint32_t *) myPtr;
|
readPos = (uint32_t *) myPtr;
|
||||||
changePos = (uint32_t *) rect;
|
changePos = (uint32_t *) rect;
|
||||||
|
|
||||||
for( index = 0; index < boxsize; index++, changePos++, readPos++ )
|
// Swap alpha byte to the end, so ARGB become RGBA;
|
||||||
*( changePos ) = ( ( *readPos & 0xFFFFFF ) << 8 ) |
|
from= (unsigned char *)readPos;
|
||||||
( ( *readPos >> 24 ) & 0xFF );
|
to= (unsigned char *)changePos;
|
||||||
|
|
||||||
|
for( index = 0; index < boxsize; index++, from+=4, to+=4 ) {
|
||||||
|
to[3] = from[0];
|
||||||
|
to[0] = from[1];
|
||||||
|
to[1] = from[2];
|
||||||
|
to[2] = from[3];
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bail:
|
bail:
|
||||||
|
Loading…
Reference in New Issue
Block a user