pdf-devel
[Top][All Lists]
Advanced

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

Re: [pdf-devel] Patch for the Flate filter


From: jemarch
Subject: Re: [pdf-devel] Patch for the Flate filter
Date: Fri, 03 Oct 2008 16:19:18 +0200
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/23.0.60 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

      > What is the concrete problem with the flate encoder?

      I hope what I said above helps on this one. :-)

   Ok, I will modify the algorithms to support this:


      - finish_p will be activated with the input buffer empty and the
        filter implementation can return PDF_ENOUTPUT until it finish
        generating data, returning PDF_EEOF.


Well, it came that it is not needed to modify the algorithm: it
already support the desired functionality: you can return PDF_ENOUTPUT
when finish_p is true to get more output space and PDF_EEOF when you
are finish. 

You cannot return PDF_NEINPUT, but it should not be a problem, since
any previous data in the filter chain has been already processed when
you get finish_p = PDF_TRUE.

As an example, there is the code for the ascii 85 filter, that uses ~>
as the EOD marker:

  if (finish_p)
    {
      if (!pdf_stm_buffer_full_p (out))
        {
          if (!filter_state->wrote_eod_1)
            {
              out->data[out->wp++] = '~';
              filter_state->wrote_eod_1 = PDF_TRUE;
              return PDF_ENOUTPUT;
            }
          else
            {
              out->data[out->wp++] = '>';
              return PDF_EEOF;
            }
        }
      else
        {
          return PDF_ENOUTPUT;
        }
    }

The above example works fine with a cache of size 1, returning
PDF_ENOUTPUT to get more output space.





reply via email to

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