pdf-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pdf-devel] Bug in LZW filter?


From: Georg Gottleuber
Subject: Re: [pdf-devel] Bug in LZW filter?
Date: Tue, 29 Nov 2011 12:57:52 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20111101 Thunderbird/7.0.1

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On 29.11.2011 08:37, Aleksander Morgado wrote:
> As you probably know already, digesting this algorithm is pretty 
> tough :-) It would be great if you could document all your
> findings already in the source code, so that one can follow both
> the flow and the comments when reading it.

Commented pdf-stm-f-lzw.c is attached.

I'm going to rewrite the encoder to follow the instructions of
ISO32000 strictly. It will look like:

while (!pdf_buffer_eob_p (in) && !pdf_buffer_full_p (out))
  {
    /* accumulate input data */
    st->string.suffix = in->data [in->rp++];
    if (!lzw_dict_find (&st->dict, &st->string))
      {
        /* emit ouput code */
        lzw_buffer_put_code (&st->buffer, st->string.prefix);
        /* create new dict entry */
        lzw_dict_create_entry (&st->dict, &st->string);

        if (st->dict.size - 1 == st->buffer.maxval - st->early_change)
          {
            /* bitsize increase here */
          }
      }
  }

Regards,
Georg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7UyL8ACgkQ5sLITM1qIaLraACgmu1J+kwNjfql8p+HXv+t+HGo
oZ0AnjqT+8p+OOceSEKMgkDPAHJ5FAj0
=br91
-----END PGP SIGNATURE-----

Attachment: pdf-stm-f-lzw_commented.c
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]