![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Сжатие RLE или HEX для bmp [D7, WinXP]
Eraser © (2005-01-27 15:23:00)Посоветуйте пожалуйста хорошие компоненты/алгоритмы для сжатия bmp простыми и быстрыми алгоритмами (RLE или HEX например).
Очень благодарен!
Hokum (2005-05-15 22:36:00) [1]XProger, пытался. Да только с Delphi работую только 3 месяца. Поэтому и не всегда получается все понять.
P.S.
Да ладно чего тебе стоит.
XProger (2005-05-15 15:31:00) [2]Hokum, а разобраться в коде не пробовал?
P.S.
Долой лентяев!
Hokum (2005-05-14 14:59:00) [3]Поэтоиу спрашиваю програму.
Hokum (2005-05-14 14:56:00) [4]Нет, и не замечаю, по крайней мере он почемуто не пашет.
XProger (2005-05-13 15:59:00) [5]Hokum, а ты четвёртый пост не заметил? ;)
Hokum (2005-05-13 14:55:00) [6]А исходник или програму RLE кодирования не скинете? ;)
miek (2005-02-03 14:38:00) [7]Zlib идет в комплекте с Delphi, начиная где-то с 3-ей версии.
Chaser (2005-02-03 09:59:00) [8]Eraser, не могли бы Вы выслать алгоритм zlib?
Буду признателен.
chaser@front.ru
dmk (2005-02-03 00:52:00) [9]
void decode ()
{
int ch, i;
while (1)
{
ch=fgetc(fpin);
if (feof(fpin) || ferror(fpin))
break;
if (ch > 127)
{
i = ch - 127; /* i is the number of repetitions */
/* get the byte to be repeated */
ch = fgetc(fpin);
if (feof(fpin) || ferror(fpin))
{
puts("\nERROR: premature end of file\n");
break;
}
/* uncompress a chunk */
for ( ; i ; i--)
fputc(ch, fpout);
}
else
{
/* copy out some uncompressed bytes */
i = ch + 1; /* i is the no. of bytes */
/* uncompress a chunk */
for ( ; i ; i--)
{
ch = fgetc(fpin);
if (feof(fpin) || ferror(fpin))
{
puts("\nERROR: premature end of file\n");
break;
}
fputc(ch, fpout);
}
}
} /* end while */
}
dmk (2005-02-03 00:52:00) [10]
void encode ()
{
int ret_code;
tmpbuf_cnt = 0; /* no. of char's in tmpbuf */
outbuf_cnt = 0; /* no. of char's in outbuf */
while (1)
{
if (get_byte() == EOF) /* read next byte into ch */
break;
tmpbuf[++tmpbuf_cnt] = (unsigned char) ch;
if (tmpbuf_cnt == 3)
{
/* see if all 3 match each other */
if ((tmpbuf[1] == tmpbuf[2])
&& (tmpbuf[2] == tmpbuf[3]))
{
/* they do - add compression */
/* this will process all bytes in input file until
a non-match occurs, or 128 bytes are processed,
or we find eof */
ret_code=process_comp();
if (ret_code == EOF_FOUND)
break; /* stop compressing */
if (ret_code == NON_MATCH)
tmpbuf_cnt=1; /* save the char that didn't match */
else
/* we just compressed the max. of 128 bytes */
tmpbuf_cnt=0; /* start over for next chunk */
}
else
{
/* we know the first byte doesn't match 2 or more
others, so just send it out as uncompressed. */
process_uncomp(tmpbuf[1]);
/* see if the last 2 bytes in the buffer match */
if (tmpbuf[2] == tmpbuf[3])
{
/* move byte 3 to position 1 and pretend we just
have 2 bytes -- note that the first byte was
already sent to output */
tmpbuf[1]=tmpbuf[3];
tmpbuf_cnt=2;
}
else
{
/* send byte 2 and keep byte 3 - it may match the
next byte. Move byte 3 to position 1 and set
count to 1. Note that the first byte was
already sent to output */
process_uncomp(tmpbuf[2]);
tmpbuf[1]=tmpbuf[3];
tmpbuf_cnt=1;
}
}
}
} /* end while */
flush_outbuf();
}
test1 (2005-02-02 22:45:00) [11]Бери TGA формат, там есть поддержка RLE
Eraser (2005-01-27 21:36:00) [12]miek ©
Это у меня есть...
miek (2005-01-27 16:58:00) [13]Zlib