pdf-devel
[Top][All Lists]
Advanced

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

Re: [pdf-devel] ASCII85Decode implementation


From: Cirilo Bernardo
Subject: Re: [pdf-devel] ASCII85Decode implementation
Date: Sun, 9 Mar 2008 09:00:14 +1100

On Sat, Mar 8, 2008 at 11:59 PM,  <address@hidden> wrote:
>
>  We need to introduce a change in the stm module API and in the filters
>  management: the memory should be allocated by the caller and should be
>  possible to apply a filter using repeated calls. As in:
>
>   /* create a stm and install filters for read... */
>   /* allocate a 10k buffer... */
>   /* read 10k and check for eof... */
>   /* allocate 10k... */
>   /* read 10k and check for eof... */
>   ...
>

I don't understand this scheme - a stream tells you how long its input
data segment is.   In the case of an ASCII85 or ASCIIHEX stream, you
only need to read 5 and 2 bytes at a time to decode; the operating
system will handle the file buffering.  For the decoded stream,
ASCII85 and ASCIIHEX have predictable sizes; in fact you always know
the length of the decoded ASCIIHEX and you can predict the ASCII85
result to within 4 characters.   Except for very large streams such as
audio and video, I don't see a point in piecemeal memory allocation;
that will only result in poor performance and a horribly fragmented
memory table.  I also don't understand why the caller should  allocate
memory when in principle the caller should be ignorant of the details
of the filter behavior.  I would not expect any module except for the
filter itself to be able to guess and successfully allocate memory in
a sensible way.

- Cirilo




reply via email to

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