From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 1/2] stkutil: convert img to xpm
Date: Fri, 23 Jul 2010 16:46:51 -0500 [thread overview]
Message-ID: <4C4A0DCB.7050706@gmail.com> (raw)
In-Reply-To: <20100723143913.7756e88e@kcaccard-MOBL3>
[-- Attachment #1: Type: text/plain, Size: 3571 bytes --]
Hi Kristen,
On 07/23/2010 04:39 PM, Kristen Carlson Accardi wrote:
> On Fri, 23 Jul 2010 16:03:16 -0500
> Denis Kenzior <denkenz@gmail.com> wrote:
>
>> Hi Kristen,
>>
>> On 07/23/2010 03:52 PM, Kristen Carlson Accardi wrote:
>>> On Fri, 23 Jul 2010 15:03:59 -0500
>>> Denis Kenzior <denkenz@gmail.com> wrote:
>>>>
>>>> This also brings up another point. You're assuming that the caller is
>>>> appending the CLUT right after the image data and massaging the clut
>>>> offset appropriately. This is a really bad idea since the caller will
>>>> have to do some significant pre-processing.
>>>>
>>>> You can handle this in one of two ways:
>>>>
>>>> 1. Assume the calling logic will read the entire image file before
>>>> calling this function. In this case, modifying the signature as follows
>>>> might be a good idea:
>>>>
>>>> char *stk_image_to_xpm(const unsigned char *file,
>>>> unsigned short file_len,
>>>> enum stk_img_scheme scheme,
>>>> unsigned short img_offset,
>>>> unsigned short img_len);
>>>>
>>>> 2. Assume the calling logic is clever and will optimize reading of the
>>>> file, including peeking into the image header to determine the where the
>>>> CLUT is located and reading it. In this case you can either reuse the
>>>> signature from 1 above, or come up with something else.
>>>>
>>>> Remember, reading from the SIM is extremely slow, so any and all clever
>>>> optimization tricks are definitely wanted.
>>>
>>> So, is it likely given normal usage that we'll access an image a single
>>> image at a time, or is it more likely that we'll access a bunch of images
>>> all at once? It may be better to read an entire image data file (with
>>> multiple images) and keep it cached if we are likely to immediately
>>> need the other images. In which case I'd be inclined to just pass
>>> in the entire data image file and the offset like you have above. If
>>> we are only likely to use a single image for any given length of time,
>>> then it seems better to have the caller be smart and pass us the clut.
>>
>> The problem is we just don't know, so we have to assume the worst case.
>> Anything that minimizes the number of reads is a good thing (TM).
>>
>> For instance, you might have couple of dozen images from EFimg dispersed
>> among multiple EFiidf files. Each EFiidf file might be 65K in length,
>> but EFimg files might only refer to about 10k from all of them.
>>
>> It is perfectly OK for EFiidf to contain mostly garbage (e.g. for future
>> updates, installation of new SIM Toolkit applications on the SIM +
>> associated image data, etc) So you simply can't assume any sort of
>> packing or efficient storage use.
>>
>> In this case, a clever algorithm that minimizes the number of SIM
>> fetches is needed.
>>
>> Regards,
>> -Denis
>
> If that is the case then I propose we assume a smart algorithm fetched
> our data for us and change the signature to something like this:
>
> unsigned char *stk_image_to_xpm(const unsigned char *image_body,
> enum stk_image_scheme scheme,
> unsigned int height,
> unsigned int width, unsigned int ncolors,
> const unsigned char *clut);
>
> We would assume that the caller has done all the sanity checking on
> the file and handed us a clut of appropriate size as well.
You sure you want unsigned char * as the return and not char *?
Also, you might want to change unsigned ints to unsigned chars. The
image size and CLUT size can never be more than 256.
Regards,
-Denis
next prev parent reply other threads:[~2010-07-23 21:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-23 0:10 [PATCH 0/2] convert img to xpm Kristen Carlson Accardi
2010-07-23 0:10 ` [PATCH 1/2] stkutil: " Kristen Carlson Accardi
2010-07-23 20:03 ` Denis Kenzior
2010-07-23 20:52 ` Kristen Carlson Accardi
2010-07-23 21:03 ` Denis Kenzior
2010-07-23 21:39 ` Kristen Carlson Accardi
2010-07-23 21:46 ` Denis Kenzior [this message]
2010-07-23 22:02 ` Kristen Carlson Accardi
2010-07-23 22:03 ` Denis Kenzior
2010-07-23 0:10 ` [PATCH 2/2] test-stkutil: unit test for img to xpm converter Kristen Carlson Accardi
-- strict thread matches above, loose matches on Subject: below --
2010-07-26 18:27 [PATCH 0/2] convert images to xpm Kristen Carlson Accardi
2010-07-26 18:27 ` [PATCH 1/2] stkutil: convert img " Kristen Carlson Accardi
2010-07-26 19:47 ` Denis Kenzior
2010-07-22 5:06 [PATCH 0/2] " Kristen Carlson Accardi
2010-07-22 5:06 ` [PATCH 1/2] stkutil: " Kristen Carlson Accardi
2010-07-22 16:12 ` Denis Kenzior
2010-07-22 19:53 ` Kristen Carlson Accardi
2010-07-22 20:05 ` Denis Kenzior
2010-07-23 2:55 ` Marcel Holtmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C4A0DCB.7050706@gmail.com \
--to=denkenz@gmail.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.