🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
13 messages
13 total messages Started by The Archiver Mon, 30 Jul 2001 12:29
CP compression (or any) - some numbers...
#53558
Author: The Archiver
Date: Mon, 30 Jul 2001 12:29
69 lines
2307 bytes
If someone wants to define a new scheme for compressing 
binaries efficiently (with an 8 bit mode) and has to encode
special chars (NUL, TAB, CR, LF) with 'escape chars':

I did a scan on a few common filetypes and made an 
evaluation of the occurrence of bytes.
A good compressed file would have an occurence of
approx 0.39% for each binary value (1 / 256).

1500 JPG pictures:

0x00: 1.3 %
0x01: 0.42 %
0xFE: 0.52 %
0xFF: 0.7%

500 MB AVI-DivX files

0x00: 1.54%
0x01: 0.69%
0x05: 0.71%
0x80: 0.68%
0xFF: 0.33%

500 MB  MP3-files

0x00: 1.77%
0x01: 0.43%
0xFB: 0.62%
0xFF: 1.30%

500 MB MPG file (movie)

0x00: 4.6%  (!)
0x01: 1.3%
0x02: 0.7%
0x60: 0.5%
0x80: 0.9%
0xFE: 0.28%
0xFF: 0.78%

In the 'extreme' case an MPG file would result in an overhead
of > 8% if all NULL chars would be encoded with a double
byte escape character.


If I would be the one who defines a new encoding then I would
introduce a fixed (or variable) additive factor to each byte before
encoding (and checking for NUL,TAB,CR,LF) is done.

For a fixed value I would propose to add '42' to each byte
before encoding.

This makes sure that the special chars (FE,FF,00..31) are all
moved to '7-bit-ascii' and just the uncommon characters
214,223,224,227 are encoded with a two byte escape value.

Compressed binaries really tend to use 00/01/FF more often
than other values. And if a simple addition can save up to 8%
then it might be worth thinking about it.


Just my three cents (one cent for my binary archive ;-)
Thanks for considering.

-- 
Juergen, [The Archiver]

Re: CP compression (or any) - some numbers...
#53570
Author: Stuart
Date: Tue, 31 Jul 2001 13:03
138 lines
6598 bytes
In article <0529e.u71200@archiver.winews.net>, The Archiver says...
> If someone wants to define a new scheme for compressing 
> binaries efficiently (with an 8 bit mode) and has to encode
> special chars (NUL, TAB, CR, LF) with 'escape chars':
> 
> I did a scan on a few common filetypes and made an 
> evaluation of the occurrence of bytes.
> A good compressed file would have an occurence of
> approx 0.39% for each binary value (1 / 256).
> 
> 1500 JPG pictures:
> 
> 0x00: 1.3 %
> 0x01: 0.42 %
> 0xFE: 0.52 %
> 0xFF: 0.7%
> 
> 500 MB AVI-DivX files
> 
> 0x00: 1.54%
> 0x01: 0.69%
> 0x05: 0.71%
> 0x80: 0.68%
> 0xFF: 0.33%
> 
> 500 MB  MP3-files
> 
> 0x00: 1.77%
> 0x01: 0.43%
> 0xFB: 0.62%
> 0xFF: 1.30%

Did the MP3s have ID3/ID3v2 tags? Those MP3s I've investigated could 
very much do with an additional compression stage (silence in MP3s seems 
to be encoded as a long string of 0xFFs) A simple RLE-like scheme would 
probably be sufficient for this and perhaps the other file types you've 
investigated.

> 500 MB MPG file (movie)
> 
> 0x00: 4.6%  (!)
> 0x01: 1.3%
> 0x02: 0.7%
> 0x60: 0.5%
> 0x80: 0.9%
> 0xFE: 0.28%
> 0xFF: 0.78%
> 
> In the 'extreme' case an MPG file would result in an overhead
> of > 8% if all NULL chars would be encoded with a double
> byte escape character.

Adding approx 46MB to the size of the encoded file if QPLite were to be 
used. Were those 00s packed together such that an RLE scheme would work 
well? Anyway, a good case for some kind of simple pre-compression could 
be made for this type of file (and to a lesser but still IMO significant 
extent the others you investigated) 1-5% compression on all the above 
file types could be achieved before any further encoding steps took 
place.

I don't suppose you've got a small piece of Win32 software which could be 
used to investigate the statistical distribution for further files, 
or file collections? Did you write something yourself?

> If I would be the one who defines a new encoding then I would
> introduce a fixed (or variable) additive factor to each byte before
> encoding (and checking for NUL,TAB,CR,LF) is done.
> 
> For a fixed value I would propose to add '42' to each byte
> before encoding.
> 
> This makes sure that the special chars (FE,FF,00..31) are all
> moved to '7-bit-ascii' and just the uncommon characters
> 214,223,224,227 are encoded with a two byte escape value.

Or a translation table calculated for each individual file (in order to 
avoid any other, rarer files messing up file size) downside being it 
would be a two pass algorithm. Any such scheme would save (since 1 byte 
is being used instead of two) for each escaped value around 1.5%, plus 
any savings made by the offset, translation &/or compression.

Since there's only 4 values which require escaping, the required data 
could be stored in 2 bits, and those 2 bits used to determine which value 
should replace the escape byte in the encoded file. This property can be 
used to make further space savings in the resulting encoded file.

You could use a 7x2 bit array of values in a two byte matrix (high bit 
set and ignored in each byte, in order to avoid clashes with escaped 
values) after the first of every 7 escape bytes. Every time you encounter 
a value which requires escaping, check forwards in the file until you 
find the next six (should need to check forwards an average of 
7x256/4=448 bytes, assuming the file has been 'fixed' to avoid high 
statistical occurances of the values in question first) Encode the 2 bit 
values after the first escape character, and replace the subsequent six 
escaped values with the escape byte. On decoding, the 7x2 bit array would 
be used as a reference for the next seven occurances of the escape byte. 
A 3x2 bit 1 byte array could be used, at a loss of efficiency, and a 4x2 
bit 1 byte array, at increased coding complexity (the resulting value 
possibly requiring escaping itself)

Despite the explanation being a little bit more complicated than 'use a 
byte offset' this would not IMO be difficult to implement, and would 
provide a further 1.1% saving.

Overhead comparisons:

UUEncoding: 40%
Base64: 37%
QPLite: 3% (average)
QPLite+file of all escaped values: 200% (worst case scenario)
QPLite+offset+1 byte per escape value: 1.5%
Compression+QPLite+1 byte escape value: <1.5% (offset not required)
QPLite+3x2 bit escape values(1 byte array): 0.5%
QPLite+7x2 bit escape values(2 byte array): 0.45%
QPLite+4x2 bit escape values(1 byte array+overhead): 0.4%

Compression could also be applied to the last 3, giving a good chance all 
encoded files will be smaller than the original.

> Compressed binaries really tend to use 00/01/FF more often
> than other values. And if a simple addition can save up to 8%
> then it might be worth thinking about it.

I'd say so. The loss is backwards compatability, though QP-Lite as it 
stands could continue to be used, and an external decoder (which may or 
may not be built into the newsreader depending on takeup) could be used 
on the QP-decoded files in order to retrieve the original unencoded file.

> Just my three cents (one cent for my binary archive ;-)
> Thanks for considering.

I'd like to see something along these lines implemented, even though I'm 
a mere user :) I wouldn't want any efforts for QP-Lite as a standard to 
become fragmented before we've even left the starting block though.

-- 
Stuart
Re: CP compression (or any) - some numbers...
#53582
Author: The Archiver
Date: Wed, 01 Aug 2001 07:30
133 lines
5947 bytes
Stuart <stuart@knapton.clara.co.uk> wrote:

>> 500 MB  MP3-files
>> 
>> 0x00: 1.77%
>> 0x01: 0.43%
>> 0xFB: 0.62%
>> 0xFF: 1.30%
>
>Did the MP3s have ID3/ID3v2 tags? 

I must admit that I oisted to my (own) MP3s.
I ever checked their bits.

>Those MP3s I've investigated could 
>very much do with an additional compression stage (silence in MP3s seems 
>to be encoded as a long string of 0xFFs) A simple RLE-like scheme would 
>probably be sufficient for this and perhaps the other file types you've 
>investigated.

It might be a good idea to compress such formats.
But Usenet neticens are smart enough that they usually compress 
binaries when it makes sense.

>> In the 'extreme' case an MPG file would result in an overhead
>> of > 8% if all NULL chars would be encoded with a double
>> byte escape character.
>
>Adding approx 46MB to the size of the encoded file if QPLite were to be 
>used. 

Yes, but if an 'additive shift' is used then this is not the case.

>Were those 00s packed together such that an RLE scheme would work 
>well? 

I did not analyse double bytes or use a compressor on them.
I simply counted the bytes. 

>Anyway, a good case for some kind of simple pre-compression could 
>be made for this type of file (and to a lesser but still IMO significant 
>extent the others you investigated) 1-5% compression on all the above 
>file types could be achieved before any further encoding steps took 
>place.

Perhaps I should make the same test after applying a pre-compression
to all these filetypes. The mostly used compressor is PkZip/WinZip.

>I don't suppose you've got a small piece of Win32 software which could be 
>used to investigate the statistical distribution for further files, 
>or file collections? Did you write something yourself?

My own software contains a package which scans files, creates
checksums and CRCs and manages all results in a small database.
This way I can identify duplicates and renamed files.

Adding a byte-value-counter was very easy.
And making the same tests again on the same sources - but 
precompressed with ZIP would be not a big job.
(Yes, I really forgot to analyse the ZIP-format).

>> For a fixed value I would propose to add '42' to each byte
>> before encoding.

>Or a translation table calculated for each individual file 
>[...]
>Despite the explanation being a little bit more complicated than 'use a 
>byte offset' this would not IMO be difficult to implement, and would 
>provide a further 1.1% saving.

I assume that saving 30% of bandwidth is the biggest step.
Of course there should be options to make further enhancements
in a new format. But whether savings in the range of 1-3% are worth
the effort is not clear to me.

>Overhead comparisons:
> [...]

Thanks for taking the time to create this list.

>Compression could also be applied to the last 3, giving a good chance all 
>encoded files will be smaller than the original.

Perhaps we should think about this in more depth:

I see good chances to introduce a very compact encoding (as QP-Lite
or yEnc) to the Usenet-community. The users are waiting for it - and the
programmers would have to do no big job to implement it if they
can get free sources and a public domain method - and the work is small.

Adding the complexity of a compression into an encoding would require
a free (and powerful) compressor - which could be also offered as
freeware and public domain source. 
If we limit the typical 'chunck' of a multipart post to 1 MB then such a
compressor could work on a memory array - and could be easily added
as a module.   

Introducing a new compression together with a new encoding might be
a good idea (or at least having predefined options for such a compression).

But I'm not sure how difficut it would be to offer source-codes for the 
different programming languages. I assume that most news-tools are
written in C/C++ - but there might be also Basic/Delphi/.... tools.
Adapting a simply algorithm to other languages is easy.
Adapting (rewriting) a compression algorithm together with testing it
is a far more complex - and time consuming - thing.


Making two steps in one might be a good idea.
But perhaps here the second step is so long that we will fail
to make to the first one.


>I'd like to see something along these lines implemented, even though I'm 
>a mere user :) I wouldn't want any efforts for QP-Lite as a standard to 
>become fragmented before we've even left the starting block though.

I've done my own first steps by implementing a special form of
QP-lite into my own news-software. So from now on I can easily 
modify it (in encoding, compression, .....)
(Whoever runs Borland C 4.52 and needs a playground can have it)

Unfortunately I have no idea how long it would take to have even 
a first specification for QP-lite. (Jeremy ?)
So actually we have no base to build on.

btw.: I saw a posting with:   qp-lite [tm]
The [tm] sign is a critical thing for me.
If someone has the trandemark on it, then it cannot be used.

-- 
Juergen, [The Archiver]
Re: CP compression (or any) - some numbers...
#53592
Author: J.B. Moreno
Date: Wed, 01 Aug 2001 17:37
31 lines
2138 bytes
In article <16309.181202@archiver.winews.net>, 
 The Archiver <archiver@i3w.com> wrote:

> Unfortunately I have no idea how long it would take to have even 
> a first specification for QP-lite. (Jeremy ?)
> So actually we have no base to build on.

A specification for QP-lite isn't really necessary, it can be handled
under the more general case of QP.

I have done test with QP-lite, labeling it as QP -- it works with
Outlook Express (Mac and PC), Netscape (Mac and PC), Turnpike, Agent
and I'm sure others.

If you know of any general decoder for the PC and wanted to check it
out, I'm sure you'd find that most (maybe all) that can deal with
Quoted-Printable can deal with QP-lite (provided nulls are escaped
which isn't a problem as they apparently have to be escaped for
transport reasons).

What's needed is to get posting programs to /use/ it.

> btw.: I saw a posting with:   qp-lite [tm]
> The [tm] sign is a critical thing for me.
> If someone has the trandemark on it, then it cannot be used.

That was undoubtably someone just fooling around.

-- 
J.B. Moreno
Re: CP compression (or any) - some numbers...
#53594
Author: meowbot
Date: Wed, 01 Aug 2001 19:11
15 lines
1721 bytes
The Archiver wrote:

>btw.: I saw a posting with:   qp-lite [tm]
>The [tm] sign is a critical thing for me.
>If someone has the trandemark on it, then it cannot be used.

Don't worry about it.  I started doing that as an act of random
stupidity, and Barry decided it was sufficiently stupid to
"incorporate" into his own "interesting" "dialogue," and it was
all downhill from there.  There is no trademark.

"'There Is No Trademark' is not a trademark" is a registered
trademark of the Society for the Prevention of Gratuitious
Trademarking.
Re: CP compression (or any) - some numbers...
#53608
Author: Jeremy
Date: Thu, 02 Aug 2001 09:01
18 lines
1340 bytes
The Archiver <archiver@i3w.com> wrote:

> Unfortunately I have no idea how long it would take to have even 
> a first specification for QP-lite. (Jeremy ?)

Soon as I sit down and write the thing. :)  It's really pretty simple,
so it won't take much...

> btw.: I saw a posting with:   qp-lite [tm]
> The [tm] sign is a critical thing for me.
> If someone has the trandemark on it, then it cannot be used.

Just joking around.  I invented the thing, and I say there's no
trademark, patent, or anything else. :)

-- 
Jeremy  |  jeremy@exit109.com
Re: CP compression (or any) - some numbers...
#53609
Author: A Meowbot
Date: Thu, 02 Aug 2001 12:56
16 lines
1779 bytes
Jeremy <jeremy@exit109.com> wrote:

> Just joking around.  I invented the thing,

In fairness, reinvented.  Luc Rooijakkers proposed the identical
encoding about 1992.  It was to be a part of MIME, and called either
quoted-binary or quoted-8bit.  It was specfically intended to help out
Son-of-1036.

The encoding was well received by the ietf-822 gh0dz, so it isn't
really clear why it never made its way into an RFC.

> and I say there's no trademark, patent, or anything else. :)

This appears to be the case for the earlier incarnation as well.
Re: CP compression (or any) - some numbers...
#53622
Author: Jeremy
Date: Thu, 02 Aug 2001 19:44
16 lines
1369 bytes
A Meowbot  <meowbot@meowing.net> wrote:

>> Just joking around.  I invented the thing,
> 
> In fairness, reinvented.  Luc Rooijakkers proposed the identical
> encoding about 1992.  It was to be a part of MIME, and called either
> quoted-binary or quoted-8bit.  It was specfically intended to help out
> Son-of-1036.

Is it written up anywhere?  I'd never heard of it before.  If there's
a previous write-up, I should read it before I write something of my
own and start pushing this thing. :)

-- 
Jeremy  |  jeremy@exit109.com
Re: CP compression (or any) - some numbers...
#53624
Author: meowbot
Date: Thu, 02 Aug 2001 22:41
32 lines
2591 bytes
Jeremy wrote:

[qp-lite, or quoted-8bit, or whatever the hell you want to call it)

>Is it written up anywhere?  I'd never heard of it before.  If there's
>a previous write-up, I should read it before I write something of my
>own and start pushing this thing. :)

One of the really annoying things about Internet Drafts is that the IETF go
out of their way to destroy them at expiration, even replacing the files
with "this document has been deleted..." notes so that mirrors lose them
too.  So, any formal write-up is probably long gone (but it should be
enough to just refer to RFC 2045 and explain the differences in character
ranges between -printable and -8bit).

The 822 list is archived pretty much forever, so at least the surrounding 
public discussions survive.  

There is a thread under
<URL:http://www.imc.org/ietf-822/old-archive1/subject.html> that pretty much 
covers it -- scoot down to "quoted-binary: an idea whose time has come?" for
the meat, though I don't think you'll see much of anything that hasn't been 
discussed this time around.  Who knows, maybe seeing other peoples' 
descriptions of the thing will make it easier to document.

It does, however, provide some context for any effort to turn it official-like 
and stuff; the red tape for making that happen is in RFC 2048.  It takes a
standards-track RFC to get a new transfer encoding, but given the nice, neat,
specific scope, that might not be so painful.


Re: CP compression (or any) - some numbers...
#53631
Author: The Archiver
Date: Fri, 03 Aug 2001 06:48
20 lines
1416 bytes
"J.B. Moreno" <planb@newsreaders.com> wrote:

>> Unfortunately I have no idea how long it would take to have even 
>> a first specification for QP-lite. (Jeremy ?)
>> So actually we have no base to build on.
>
>A specification for QP-lite isn't really necessary, it can be handled
>under the more general case of QP.

It will be hard to find someone who implements it into a freeware 
encoder if this requires reading (and understanding) all that 
MIME stuff and finding out the relevant parts.

-- 
Juergen, [The Archiver]




Re: CP compression (or any) - some numbers...
#53632
Author: The Archiver
Date: Fri, 03 Aug 2001 06:50
25 lines
1525 bytes
Jeremy <jeremy@exit109.com> wrote:

>> Unfortunately I have no idea how long it would take to have even 
>> a first specification for QP-lite. (Jeremy ?)
>
>Soon as I sit down and write the thing. :)  It's really pretty simple,
>so it won't take much...

Thank you.

>> btw.: I saw a posting with:   qp-lite [tm]
>> The [tm] sign is a critical thing for me.
>> If someone has the trandemark on it, then it cannot be used.
>
>Just joking around.  I invented the thing, and I say there's no
>trademark, patent, or anything else. :)

Good to know.
I was really frightened when I saw the [tm] in a Google search.

-- 
Juergen, [The Archiver]


Re: CP compression (or any) - some numbers...
#53643
Author: Jeremy
Date: Fri, 03 Aug 2001 20:24
24 lines
1730 bytes
 <meowbot@meowing.net> wrote:

> There is a thread under
> <URL:http://www.imc.org/ietf-822/old-archive1/subject.html> that pretty
> much covers it -- scoot down to "quoted-binary: an idea whose time has
> come?" for the meat, though I don't think you'll see much of anything
> that hasn't been discussed this time around.  Who knows, maybe seeing
> other peoples' descriptions of the thing will make it easier to
> document.

From the discussion, it doesn't sound like there was even an Internet Draft
on the thing.

> It does, however, provide some context for any effort to turn it
> official-like and stuff; the red tape for making that happen is in RFC
> 2048.  It takes a standards-track RFC to get a new transfer encoding,
> but given the nice, neat, specific scope, that might not be so
> painful.

It doesn't sound so bad.  It may be worth trying.

-- 
Jeremy  |  jeremy@exit109.com
Re: CP compression (or any) - some numbers...
#53646
Author: J.B. Moreno
Date: Fri, 03 Aug 2001 23:17
37 lines
2521 bytes
In article <54488.381200@archiver.winews.net>, 
 The Archiver <archiver@i3w.com> wrote:

> "J.B. Moreno" <planb@newsreaders.com> wrote:
> 
> >> Unfortunately I have no idea how long it would take to have even 
> >> a first specification for QP-lite. (Jeremy ?)
> >> So actually we have no base to build on.
> >
> >A specification for QP-lite isn't really necessary, it can be handled
> >under the more general case of QP.
> 
> It will be hard to find someone who implements it into a freeware 
> encoder if this requires reading (and understanding) all that 
> MIME stuff and finding out the relevant parts.

I think you're overestimating the cost of parsing the MIME stuff and
finding the relevant parts -- if you limit it to the simple case (two
parts at most, first part an optional text message with no subparts),
that is less complicated than dealing with the problem of subject vs
file names and whether all of the articles necessary to reassemble a
binary are present.

And it gives you a great opportunity (and method) to include such
information in a clear cut, easily understood way:  add headers to the
binary part.

Parts-list: <message-id1> <message-id2> <etc>
Final-Part-Name: "tract 1 of disk 2 of a 3 disk set by led zeppelin"
Header-whatever:

And people can finally stop trying to cram everything into the Subject
header.

-- 
J.B. Moreno
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads