packbits optimization #2
This commit is contained in:
parent
de15e1036f
commit
bcbedab22d
@ -2208,6 +2208,10 @@ void Load_IFF(T_IO_Context * context)
|
||||
|
||||
if (IFF_list_size>0)
|
||||
{
|
||||
if (IFF_list_size > 128)
|
||||
{
|
||||
GFX2_Log(GFX2_ERROR, "Transfer_colors() IFF_list_size=%d !\n", IFF_list_size);
|
||||
}
|
||||
if (IFF_repetition_mode)
|
||||
{
|
||||
Write_one_byte(file,257-IFF_list_size);
|
||||
@ -2260,10 +2264,9 @@ void Load_IFF(T_IO_Context * context)
|
||||
else if ( (IFF_repetition_mode) || (second_last_color!=color) )
|
||||
// On conserve le mode...
|
||||
{
|
||||
IFF_color_list[IFF_list_size]=color;
|
||||
IFF_list_size++;
|
||||
if (IFF_list_size==128)
|
||||
Transfer_colors(file);
|
||||
IFF_color_list[IFF_list_size++]=color;
|
||||
}
|
||||
else // On est en mode <> et on a 3 couleurs qui se suivent
|
||||
{
|
||||
@ -2280,9 +2283,9 @@ void Load_IFF(T_IO_Context * context)
|
||||
{
|
||||
if (!IFF_repetition_mode) // On conserve le mode...
|
||||
{
|
||||
IFF_color_list[IFF_list_size++]=color;
|
||||
if (IFF_list_size==128)
|
||||
if (IFF_list_size == 128)
|
||||
Transfer_colors(file);
|
||||
IFF_color_list[IFF_list_size++]=color;
|
||||
}
|
||||
else // On change de mode...
|
||||
{
|
||||
|
||||
@ -161,11 +161,21 @@ int Test_Packbits(void)
|
||||
"12345678123456781234567812345678" // 32
|
||||
"12345678123456781234567812345678" // 64
|
||||
"12345678123456781234567812345678" // 96
|
||||
"12345678123456781234567812345678" // 128
|
||||
"1", // best : 127(7f) "123..." 01 "1" => 131
|
||||
"12345678123456781234567812345678" // 32
|
||||
"12345678123456781234567812345678" // 64
|
||||
"12345678123456781234567812345678" // 96
|
||||
"123456781234567812345678123456@@" // 128
|
||||
"@@12345678", // best : 125(7d) "123..." -3 '@' 08 "12345678" => 138
|
||||
"12345678123456781234567812345678" // 32
|
||||
"12345678123456781234567812345678" // 64
|
||||
"12345678123456781234567812345678" // 96
|
||||
"1234567812345678123456781234567@" // 128
|
||||
"@@12345678", // best : 126(7e) "123..." -2 '@' 08 "12345678" => 139
|
||||
NULL
|
||||
};
|
||||
const long best_packed = 7 + 22 + 23 + (138/*+2*/);
|
||||
const long best_packed = 7 + 22 + 23 + 131 + (138/*+2*/) + (139/*+1*/);
|
||||
byte buffer[1024];
|
||||
|
||||
snprintf(tempfilename, sizeof(tempfilename), "/tmp/gfx2test-packbits-%lx", random());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user