🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #61992

Re: Idea for a efficient quasi 8bit CTE (qp-special-lite)

#61992
From: Lykas
Date: Fri, 15 Nov 2002 11:10
61 lines
4000 bytes
curt@kcwc.com (Curt Welch) wrote in message news:<20021114123345.397$aD@newsreader.com>...
> lykas@gmx.ch (Lykas) wrote:
> > For a uniformaly distributed input stream the encoding overhead is
> > 2n/(8*256)*100%, where n is the number of critical characters.
> 
> I believe it will be worse than that because you will have to re-encode
> the encoding bit depending on the value of the critical characters
> and your choice of values for the encoding bit.
> 
> i.e., if you output a crtical character, then the tag bit + 7 more
> data bits goes into the next output byte.  But if those 8 bits turn
> out to be a crtical character, then you have to tag that as well, etc.
> 
You are right! The replacement characters have to be choosen so that
changing the tag bit dosen't turn them into critical characters. So
it would constrain the choice of replacement characters a bit. (In my
implementation I chose replacement character = critical character xor
128, which is ok for the three critical characters I used for the tests.)

> > For the pathological worst case the overhead is 1/8 = 12.5%.
> 
> It's actually 1/7 or 14.3% isn't it?  Because worst case, you could end up
> having to add a tag bit to every output byte so you add one bit of output
> overhead to every 7 input bits.
> 
No, you add 1 bit to every 8 input bits. The 8 bits of the critical
character become 8 bits of the non critical replacement character plus
one tag bit.

> > I have done some tests with n=3 (i.e. '\0', '\n', '\r') on a variety
> > of file types (text, mpeg, mp3, jpg, gif, png, zip, gz, ...) and have
> > never reached an overhead bigger than that of an uniform distribution
> > (0.293%).
> 
> Interesting.  But NNTP still requies CR LF to be added every so often, and
> you either must include dot in your crtical char list or do the dot
> escaping for NNTP, and TCP/IP adds a lot more overhead on top of that, so
> is there really any point in using anything more complex than yEnc when we
> already have a total encoding overhead which is much higher from all these
> other things?
> 
With a line length of 998 + CR LF you add ~0.2% overhead and you are still
below 0.5%. You can use CR or LF for padding to move the dot or critical
character strings away from the begining of a line.

> As a formal yEnc replacement, I think all that bit shifting is more complex
> than it needs to be to get the overhead low enough.
> 
It is more the "add 42" I don't like in yEnc than the overhead. Replacing
that with "xor byte_counter (modulo 256)" would be nice.

> I wonder if there is a simple byte oriented encoding system that could
> reach such low ovehead numbers without having to play bit shifting games?
> 
> I wonder if there's a way to reach the same

You can accumulate the tag bits to a byte and output them after every
seven critical/replacement characters. This is a little less efficient
and require seeking in the input stream for either encoding or decoding
(and of course still requires bit shifting).
Technical Details
Message-ID: <815b0091.0211150310.3593e877@posting.google.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!postnews1.google.com!not-for-mail
References: <815b0091.0211140844.70201d4e@posting.google.com> <20021114123345.397$aD@newsreader.com>

Show Full Headers
Complete Article Headers
Message-ID: <815b0091.0211150310.3593e877@posting.google.com>
Subject: Re: Idea for a efficient quasi 8bit CTE (qp-special-lite)
Date: Fri, 15 Nov 2002 11:10:43 +0000
From: lykas@gmx.ch (Lykas)
References: <815b0091.0211140844.70201d4e@posting.google.com> <20021114123345.397$aD@newsreader.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!postnews1.google.com!not-for-mail
Newsgroups: news.software.nntp
Organization: http://groups.google.com/
Lines: 60
NNTP-Posting-Host: 128.178.14.146
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1037358643 31111 127.0.0.1 (15 Nov 2002 11:10:43 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: 15 Nov 2002 11:10:43 GMT