LZW compression and binaryEncode

jbv jbv.silences at Club-Internet.fr
Sun Apr 17 16:07:26 CDT 2005



Dar,

Thanks again for the reply, but actually I know most of
what you explained, as I've already fiddled with the
binaryEncode function (for sound files & other data
manipulations)...
Although, several issues still remain unclear : my serie
of output indexes resulting from the LZW compression
feature more than 256 entries. Therefore I'm wondering
how this could be represented in binary, in order to be
decoded by the LZW filter in pdf...

Best,
JB

> On Apr 17, 2005, at 2:38 PM, jbv wrote:
> > But now I need to convert the output serie of index into binary
> > data... Anyone familiar with this ?
> > I guess I need to use binaryEncode, but how to set up parameters ?
>
> Normally, we think of a value in Transcript as a sequence of
> characters.  When we work with binary we can view each character as
> that for an 8-bit encoding, that is, a byte.  Thus, a value can be
> viewed as a sequence of bytes.  Just as we can concatenate characters
> with &, we an concatenate what we consider to be bytes sequences the
> same way.
>
> To get at the numerical value of the byte, you can use charToNum().
> You can also use numToChar() as the inverse.
>
> You can also use binaryEncode() and binaryDecode().  Most formats are
> in host order and so are of limited utility.  However, some formats,
> such as "N", are big endian.  If you need small endian formatting, just
> reverse.  There are some formats missing, so you would want to build up
> a few simple functions to help.
>
> For example,
>
>     put binaryEncode("N",566) into aLen
>
> would put 4 bytes (chars) into aLen.
>
> Dar
>
> --
> **************************************************
>      DSC (Dar Scott Consulting & Dar's Lab)
>      http://www.swcp.com/dsc/
>      Custom libraries (with externals, if needed)
> **************************************************
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution



More information about the use-livecode mailing list