Article View: news.software.nntp
Article #61978Idea for a efficient quasi 8bit CTE (qp-special-lite)
From: Lykas
Date: Thu, 14 Nov 2002 16:44
Date: Thu, 14 Nov 2002 16:44
34 lines
2654 bytes
2654 bytes
In the input stream all critical characters are replaced with a
pre-defined replacement charracter(*). In order to decide later on
whether an occurrence of a replacement charracter is in fact
the replacement charracter itself or the critical charracter it
replaces, we must add a tag to any of these replacement charracters.
But instead of using a whole byte ("quote character") as in 'yenc',
is suffice to use only one bit and thus reducing the encoding
overhead by a factor of four(**). In other words every critical
character and replacement character translates to 9 bits of output.
This encoding also dosen't suffer so much from the problem with
files that contain huge amounts of critical characters, as the
input characters don't end up on byte boundaries. In this way the
method does some kind of randomization of the input stream. To add
this effect (and make performance more predictable) one can xor
every input byte with a byte counter modulo 256. Which is sort of
of xor-ing the input stream with a uniformaly distributed random
byte stream. (Of course our byte stream is not random, but it _is_
uniformaly distributed.)
For a uniformaly distributed input stream the encoding overhead is
2n/(8*256)*100%, where n is the number of critical characters. For
the pathological worst case the overhead is 1/8 = 12.5%.
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%).
(* only 7bits of the replacement characters can be choosen arbitrary
one bit is reserved as an eventual tag bit).
(** the overhead is reduced by a factor 8 for every tag, but we must
tag the critical _and_ the replacement characters)
Technical Details
Message-ID:
<815b0091.0211140844.70201d4e@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-mailShow Full Headers
Complete Article Headers
Message-ID: <815b0091.0211140844.70201d4e@posting.google.com> Subject: Idea for a efficient quasi 8bit CTE (qp-special-lite) Date: Thu, 14 Nov 2002 16:44:33 +0000 From: lykas@gmx.ch (Lykas) 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: 33 NNTP-Posting-Host: 128.178.14.146 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1037292273 10157 127.0.0.1 (14 Nov 2002 16:44:33 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 14 Nov 2002 16:44:33 GMT