a compression tool useful with constrained memory
Hello all,
I'd like to contribute a tool from the last millenium which worked fine among others on 16-bit Venix/86. It is now BSD licensed, any and all related patents expired since then.
It compiles fine by bcc, works faster and produces much better compression than the 12-bit compress. Tested under elksemu.
The source is 22K bzip2 compressed, 140K uncompressed (37K if compressed by itself :)
What would be a suitable way to submit it?
Regards,
Rl
Quoted 1 line · On 4/26/2015 8:29 AM, [email protected] wrote:
What would be a suitable way to submit it?
Send it to me and I'll integrate it.
Quoted 3 lines · Jody Bruchon
Quoted 1 line · On 4/26/2015 8:29 AM, [email protected] wrote:
What would be a suitable way to submit it?
Send it to me and I'll integrate it.
Done!
Rl
Status updates: compression tool, kernel fixes, BCC features, etc.
Quoted 1 line · On 4/26/2015 9:11 AM, [email protected] wrote:
Done!
'prems' is now integrated in the ELKS elkscmd tree. I haven't tested it yet; I've only stuck it in there and made it compile, so feel free to try it out and let me know if any additional changes are needed. It is included by default in 'full3' images and the binary name is /bin/pres.
Quoted 1 line · MFLD
This patch tries to solve the problem described in the "Question on import symbols generated by BCC
I committed your other BCC patches to my dev86 tree, but this particular patch causes libc compilation to fail with "already defined" import errors. If you figure out how to fix that and re-submit, I'll test again and commit.
Quoted 1 line · Juan Perez-Sanchez
The attached patch does: (lots of good things)
Committed!
Quoted 1 line · Nils Stec
Here's my updated patch. I think this attempt is better than the first, if you still find something annoying i will fix/change it.
I will need to rewrite the code in the patch to match my current repo version before I can commit. It'll take more time than I have at the immediate moment. I've got it in my work queue and will let everyone know when I've added it.
Quoted 1 line · MFLD
I send you the HTML file directly, because the mailer daemon refuses to forward it (as HTML).
Thanks! I'll upload this when I am logged into SourceForge's systems again.
-Jody
Hello,
Here comes a patch (removing some unnecessary size limitations).
Rl
pres.c renamed from pres.c.ori +24 -14
@@ -3,6 +3,14 @@* * A library (prem/malprem) and a cli frontend to it (pres) * +* version 0.2015-04-27 +* removed undue data stream size limitations, +* now it should work for up to 2GB files, +* bigger streams will be compressed alright but +* the diagnostic messages could become wrong after 2GB +* version 0.2015-04-26 +* initial public release +* * Usage: pres [-dcfFqii] [file ...] * Flags: * -d: Decompress instead of compressing
@@ -246,8 +254,8 @@exit (exit_stat); } -long int enk;/* input data length */ -long int elk;/* compressed length */ +unsigned long int enk;/* input data length */ +unsigned long int elk;/* compressed length */ /* * Compressing input to output (one file)
@@ -267,9 +275,10 @@exit (1 ); } enk = elk =0 ; -for ( ;; ){ + b_n =0 ; +for ( ;; ++b_n ){ +/* in output we roll over every 2^16 blocks regardless the b_n type size */ d = enb; - b_n = enk /BLON ;/* the future block number */ /* fill the output buffer */ while ( d - enb <BLON && (c=getchar ()) !=EOF ){ ++enk;
@@ -311,10 +320,10 @@/* * tell the result */ -if (wcat_flg ==0 && !quiet) { -fprintf ( stderr,"Compression: %d%%" , - enk >0 ? - ( (100 * ( enk - elk )) / enk ) : +if (wcat_flg ==0 && !quiet) {long dif = (long )enk-(long )elk; +fprintf ( stderr,"Compression: %d%%" , + enk ? + (int )((dif>21474836 )?(dif/((long )enk/100 )):(100 *dif/(long )enk)) :0 ); }if (elk > enk)/* exit(2) if no compression */
@@ -439,12 +448,13 @@continue ; } } - oblk = it_blk +1 ; + oblk = (it_blk +1 )&65535 ;/* ensure rolling over every 2^16 blocks */ lon = it_lon;if ( lon ==BLON ){/* not the last block */ -if ( (i=serch ()) ==EOF /* end ??? */ - || it_blk != oblk )/* out of order */ -continue ;/* do not trust this block */ +if ( ((i=serch ()) ==EOF /* end ??? */ + || it_blk != oblk)/* out of order */ + && !ignore ) +continue ;/* do not trust the freshly uncompressed block */ }else {/* looks like the last one */ if ( ignore && (i=serch ()) !=EOF ){/* not last, look further! */
@@ -457,8 +467,8 @@continue ;/* ignoring the "last" block indication */ } } -if ( (j=oblk-b_blk-1 ) !=0 ){ -/* the next block number in order, but here there was a skip */ +if ( (j=oblk-((b_blk+1 )&65535 )) !=0 ){ +/* there was a skip */ if (fseek ( stdout, (long )oblk*(long )BLON ,0 ) <0 )/* can not seek (pipe) */ if ( j >0 && j <=10 )/* skipped blocks
flparc.c renamed from flparc.c.ori +33 -19
98 lines not on this page · raw message
another fix for huge data (Re: a compression tool useful with constrained memory)
Noticed a situation where we would divide by zero:
+ * version 0.2015-04-29
+ * avoid division by zero when the input length
+ * differs from N*4GB less than 100 bytes
Attaching a patch which should apply cleanly (build tested with a different patch version, for the original source format).
Regards,
Rl