Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F628334
compress.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
860 B
Referenced Files
None
Subscribers
None
compress.cpp
View Options
#ifdef USE_ALLEGRO
#include
<allegro.h>
#endif
#include
"compress.h"
#include
"memory.h"
#include
"debug.h"
namespace
Compress
{
void
testCompression
(
unsigned
char
*
input
,
int
length
){
#ifdef USE_ALLEGRO
unsigned
char
*
data
=
new
unsigned
char
[
length
*
2
];
PACKFILE_VTABLE
table
=
Memory
::
makeTable
();
Memory
::
memory
memory
(
data
,
length
*
2
);
PACKFILE
*
pack
=
pack_fopen_vtable
(
&
table
,
&
memory
);
LZSS_PACK_DATA
*
lzss
=
create_lzss_pack_data
();
int
r
=
lzss_write
(
pack
,
lzss
,
length
,
input
,
1
);
if
(
r
!=
0
){
// printf("lzss error %d: %s!\n", r, ustrerror(errno));
exit
(
-1
);
}
free_lzss_pack_data
(
lzss
);
pack_fclose
(
pack
);
Global
::
debug
(
0
)
<<
"Compressed "
<<
length
<<
" to "
<<
memory
.
getSize
()
<<
" ratio is "
<<
((
double
)
memory
.
getSize
()
/
length
)
<<
std
::
endl
;
delete
[]
data
;
#endif
}
}
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Sun, Nov 15, 3:50 AM (1 d, 22 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
111021
Default Alt Text
compress.cpp (860 B)
Attached To
Mode
R75 R-Tech1
Attached
Detach File
Event Timeline