git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Composite commit (GUI / Networking)
[tpg/acess2.git]
/
Usermode
/
Libraries
/
libimage_sif.so_src
/
main.c
diff --git
a/Usermode/Libraries/libimage_sif.so_src/main.c
b/Usermode/Libraries/libimage_sif.so_src/main.c
index
455d3bc
..
7b076a3
100644
(file)
--- a/
Usermode/Libraries/libimage_sif.so_src/main.c
+++ b/
Usermode/Libraries/libimage_sif.so_src/main.c
@@
-21,7
+21,7
@@
tImage *Image_SIF_Parse(void *Buffer, size_t Size)
uint16_t flags;
uint16_t w, h;
int ofs, i;
uint16_t flags;
uint16_t w, h;
int ofs, i;
- tImage
_SIF
*ret;
+ tImage *ret;
int bRevOrder;
int fileOfs = 0;
int comp, fmt;
int bRevOrder;
int fileOfs = 0;
int comp, fmt;
@@
-46,21
+46,15
@@
tImage *Image_SIF_Parse(void *Buffer, size_t Size)
w = *(uint16_t*)Buffer+fileOfs; fileOfs += 2;
h = *(uint16_t*)Buffer+fileOfs; fileOfs += 2;
w = *(uint16_t*)Buffer+fileOfs; fileOfs += 2;
h = *(uint16_t*)Buffer+fileOfs; fileOfs += 2;
-
- // Allocate space
- ret = calloc(1, sizeof(tImage) + w * h * sampleSize);
- ret->Width = w;
- ret->Height = h;
-
// Get image format
switch(fmt)
{
// Get image format
switch(fmt)
{
- case 0: // ARGB
-
ret->Format = IMGFMT_ARGB
;
+ case 0: // ARGB
32-bit Little Endian
+
fmt = IMGFMT_BGRA
;
sampleSize = 4;
break;
sampleSize = 4;
break;
- case 1: // RGB
-
ret->Forma
t = IMGFMT_RGB;
+ case 1: // RGB
24-bit big endian
+
fm
t = IMGFMT_RGB;
sampleSize = 3;
break;
default:
sampleSize = 3;
break;
default:
@@
-68,6
+62,12
@@
tImage *Image_SIF_Parse(void *Buffer, size_t Size)
return NULL;
}
return NULL;
}
+ // Allocate space
+ ret = calloc(1, sizeof(tImage) + w * h * sampleSize);
+ ret->Width = w;
+ ret->Height = h;
+ ret->Format = fmt;
+
switch(comp)
{
// Uncompressed 32-bpp data
switch(comp)
{
// Uncompressed 32-bpp data
@@
-89,6
+89,7
@@
tImage *Image_SIF_Parse(void *Buffer, size_t Size)
uint8_t len;
if( fileOfs + 1 > Size ) return ret;
len = *(uint8_t*)Buffer+fileOfs; fileOfs += 1;
uint8_t len;
if( fileOfs + 1 > Size ) return ret;
len = *(uint8_t*)Buffer+fileOfs; fileOfs += 1;
+ // Verbatim
if(len & 0x80) {
len &= 0x7F;
if( fileOfs + len*sampleSize > Size ) {
if(len & 0x80) {
len &= 0x7F;
if( fileOfs + len*sampleSize > Size ) {
@@
-100,6
+101,7
@@
tImage *Image_SIF_Parse(void *Buffer, size_t Size)
}
ofs += len;
}
}
ofs += len;
}
+ // RLE
else {
uint8_t tmp[sampleSize];
else {
uint8_t tmp[sampleSize];
@@
-118,6
+120,7
@@
tImage *Image_SIF_Parse(void *Buffer, size_t Size)
return ret;
// Channel 1.7.8 RLE
return ret;
// Channel 1.7.8 RLE
+ // - Each channel is separately 1.7 RLE compressed
case 3:
// Alpha, Red, Green, Blue
for( i = 0; i < sampleSize; i++ )
case 3:
// Alpha, Red, Green, Blue
for( i = 0; i < sampleSize; i++ )
UCC
git Repository :: git.ucc.asn.au