<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Fri, 05 Nov 2010 02:06:39 +0100
From   : rick@... (Rick Murray)
Subject: Programming: Colour names in Sigsumeidsi

On 04/11/2010 16:58, J.G.Harston wrote:

>> 20 characters per name, 256*256*256 names,&14000000 bytes of storage.
>> Only 5120M ;)
> D'oh! 320M ! (20*16 not 20*256 - miscounted the zeros)

EPICALLY inefficient! I could cry. ;-)


Strip off the names as they look to be deterministic, and replace like:

   nul ->  0
   ov  ->  1
   ra  ->  2
   ga  ->  3
   ba  ->  4
   id  ->  5
   bi  ->  6
  tet  ->  7
  oct  ->  8
  hex  ->  9
   it  ->  10    ' consideration for "bi't" and "teti" which break rules?
  rip  ->  11
  mul  ->  12
    a  ->  13
  una  ->  14
  EOI  ->  15    ' to flag end of input

This means a single byte can hold two "phrases". How long is the longest 
phrase likely to be? Eight parts?

The longest example is:
   hexitudnaranulbanulga
   !  ! ????! !  ! !  !

The "udna" is not documented, typo for "una"?

Anyway, that example is eight parts. Let's be on the safe side and allow 
"up to 12 parts" if no EOI earlier.

Each byte can hold two parts, so we would require six bytes.

There's supposed to be 16 million colours.

16,777,216 colours X 6 bytes

= 100,663,296 bytes.

= 96 megabytes (exactly).


To be honest, on this alone I'd reject the lookup table. It's no trouble 
at all in going RGB -> Sigwhatsit, as you might even be able to use the 
colour value as an indice into the table. However converting back the 
other way may well involve walking the entire lookup table hoping for a 
match. You might say "why not sort it so all "hex" things are together 
and..... fair point, but this might royally break the RGB indice - you 
can't have both.

Oh, and my Neuros OSD is a reasonable example of an embedded system, 
with 32Mb RAM and 16Mb Flash [a fair few routers are much along the same 
lines]. This 96Mb table will go where? Considering that it may will be 
reducable to around 10K of object code, depending on how complicated 
this thing actually is. And what you lose converting one way, you'd more 
than make up converting back. It also wouldn't have a string length 
limit, so you could throw it some seriously evil things and it would 
still arrive at a result.


Best wishes,

Rick.

-- 
Rick Murray, eeePC901 & ADSL WiFI'd into it, all ETLAs!
BBC B: DNFS, 2 x 5.25" floppies, EPROM prog, Acorn TTX
E01S FileStore, A3000/A5000/RiscPC/various PCs/blahblah...
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>