2

Environment

  • Windows XP SP3 x32
  • Visual Studio 2005 Standard Edition
  • Honeywell Dolphin 9500 Pocket PC/Windows Mobile 2003 Platform
  • .NET Framework 1.1 and .NET Compact Framework 1.0 SP3
  • Using VC#

Problem

When I save an image from the built in camera and Honeywell SDK ImageControl to the device's storage card or internal memory, it takes 6 - 7 seconds.

I am currently saving the image as a PNG but have the option of a BMP or JPG as well.

Relevant lines in the code: 144-184 and 222, specifically 162,163 and 222.


Goal

I would like to reduce that time down to something like 2 or 3 seconds, and even less if possible.

As a secondary goal, I am looking for a profiling suite for Pocket PC 2003 devices specifically supporting the .NET Compact Framework Version 1.0. Ideally free but an unfettered short tutorial would work as well.


Things I Have Tried

  • I looked into asynchronous I/O via System.Threading a little bit but I do not have the experience to know whether this is a good idea, nor exactly how to implement threading for a single operation.
    • With threading implemented as it is in the code below, there seems to be a trivial speed increase of maybe a second or less. However, something on the next Form requires the image, possibly in the act of being saved, and I do not know how to mitigate the wait or handle that scenario at all, really.
  • EDIT: Changing the save format from PNG to BMP or JPG, with the threading, seems to reduce the save time considerably..

Code

http://friendpaste.com/3J1d5acHO3lTlDNTz7LQzB
Let me know if the code should just be posted here in code tags. It is a little long (~226 lines) so I went ahead and friendpasted it as that seemed to be acceptable in my last post.

Eric H
  • 1,100
  • 16
  • 32
  • I ran into a similar scenario 3 yrs ago: a client was using WM5 devices to let technicians do electricity installations and activations in the field. I have no advice, but came here to say I've shared your trouble. Good luck! – callisto Mar 22 '11 at 14:43
  • Oh the joys of legacy hardware... – Eric H Mar 22 '11 at 15:15

2 Answers2

3

By changing the save format from PNG to BMP and including the Threading code shown in the Code link, I was able to reduce the save time to ~1 second.

Eric H
  • 1,100
  • 16
  • 32
  • I see that I totally misunderstood your question - I thought you had already tried the code you posted and that it hadn't helped. Glad it worked for you. :) – MusiGenesis Mar 24 '11 at 23:53
1

You're at the mercy of the Honeywell SDK for this one, since their control is doing the actual saving of the image. Calling this on a separate thread (i.e. not the UI thread) isn't going to help at all (as you've found out), and it will actually make things more difficult for you since you need to wait until the save task is completed before moving on to the next form.

The only suggestion I can make is to make sure you're saving the image to internal memory (and not to the SD card), since writing to an SD card usually takes significantly longer than writing to memory. Or see if you can get technical support from Honeywell - 6-7 seconds seems way too long for a task like this.

Or see if the Honeywell SDK lets you get the image as a byte array (instead of saving to disk). If this call returns in less than 6-7 seconds, you can handle persisting it yourself.

MusiGenesis
  • 74,184
  • 40
  • 190
  • 334
  • Thanks for the reply! I found that switching to bitmap or jpeg seemed to decrease the time by half or more. Not particularly sure why. One person I talked to mentioned that it may just be handled by Windows Mobile better. Also I like the idea of using a bye array but it appears as though I can only read an image in from a byte array not export from the ImageControl to a byte array. – Eric H Mar 22 '11 at 15:07
  • Well, the PNG format requires processing, but so does JPEG, so I dunno. – MusiGenesis Mar 22 '11 at 15:34
  • PNG is lossless (typically but not always) compression and jpeg is lossy. It's throwing data out. Depending on the quality setting for jpeg, you could have a dramatically smaller file size, requiring much less time to write to storage. Also, the PNG algorithms could simply be less efficient than the jpeg ones, again resulting in longer duration. BMP is not compressed at all and results in maximum file size. Not doing the compression will gain you speed. Writing a larger file will deduct speed. – Larry Silverman Oct 28 '14 at 14:36