Larry’s Personal & Tech ramblings

Just another WordPress.com weblog

Windows Vista killed my laptop battery :(

My extended capacity laptop battery has been severely crippled and I can put 100% of the blame on Windows Vista. In previous versions of Windows, the hibernate option was a way to completely turn off the machine and restore the previous state more quickly than rebooting. Hibernate seems even more necessary for Windows Vista which takes an average of five minutes to start before it becomes usable. As with previous laptops, I started using hibernate when I shut down my machine and didn’t plan on using it for a day or more. I started to see there was a problem when I would hibernate my machine with a full charge and boot it up a few days later with a dead battery. I brushed if off at first as a quirk of the machine or maybe some timed maintenance occurring, but it kept happening. Apparently hibernate on Vista doesn’t mean the same thing. I realized this one night when I was up late and I heard my laptop wake up. Not only did it wake up and start running, but it didn’t suspend and stayed at full power in the laptop case and got extremely hot. I have my power settings so that it will automatically suspend if not used for 20 minutes. So the two battery saving features I depended on both failed me completely. Since this has happened so many times and my extended battery is now nearly useless, I have to do a complete shutdown and reboot every time I turn it off and won’t need it for more than a day. Obviously this wastes a lot of my time that previous versions of Windows didn’t waste. I’ve been testing the Windows 7 beta and it doesn’t seem to have this problem, but I still don’t trust it 100%.

June 14, 2009 Posted by bitbank | Vista sucks | | No Comments Yet

New performance figures for the JPEG codec on ARM

I recently began looking at the encoding side of my JPEG code to find ways of improving the performance. The biggest improvements came from new ideas for the JPEG compression algorithm, while others came from rewriting the C code in optimized ARM assembly language. The tests were conducted on a T-Mobile Shadow (OMAP 850, 200Mhz):

Compress 240×320 RGB24 image into JPEG with color subsampling and low output quality (10K bytes output): 63ms
Decompress the 240×320 JPEG file (10K) back into RGB565: 29ms

This speed is suitable for doing MJPEG video on handheld devices.

The file generated from the compressor is here:
240×320 test image

The assembly language code was written to use the ARMv5 instruction set. Use of ARMv6 instructions could improve performance further.

January 14, 2009 Posted by bitbank | arm, arm9, assembly language, benchmark, jpeg, omap, optimization, performance, pocket pc, smartphone, wince | | 1 Comment

WM 6.1 – A Tale of Two Operating Systems

Recently I acquired a few more devices for my software testing. I had mistakenly assumed that all Windows Mobile devices could handle using the ARMv5 instruction set. Unfortunately, Samsung proved me wrong. The Pocket PC and Phone devices which make use of the Samsung S3C24xx CPUs include an older ARM920T core which only supports ARMv4 instructions. There are some very useful instructions in ARMv5 which can help performance and shorten code. I picked up an old iPAQ rx1955 Pocket PC; it’s got a Samsung S3C2410 at 300Mhz. I also got a Samsung SCH-i320N (XScale PXA270) and a HTC Touch Dual (Qualcomm MSM-7200). Between these and the other devices, I’ve got one of every possible ARM CPU architecture (OMAP, XScale, Samsung, Qualcomm). Along the way to doing device testing, I found that the clever guys at XDA-Developers.com had figured out ways to get the WM 6.1 ROM to install on most modern WM devices. I upgraded my old T-Mobile Shadow, HTC Vox, and the new HTC Touch Dual to 6.1. I chose the HTC Touch Dual as my MSM-7200 device because it looked like a good design and appeared similar to the HTC Juno (Shadow) that I like so much. I wasn’t expecting the radical difference between the WM6.1 Standard and Pro interfaces. Here are the 2 devices in question:

HTC Touch Dual vs. HTC Juno (T-Mobile Shadow)

They both have slide out keypads and are nearly identical in size and shape. The big difference is the software. The Touch Dual runs WM 6.1 Pro (touchscreen) and the Juno runs 6.1 Standard (non-touchscreen).

I’ve been using WM Standard (non-touchscreen) as my main phone for quite a while and have gotten used to the way it does things. I appreciate that I can operate and navigate all software using only 1 hand. To operate most software I need to press one of 8 buttons: a soft menu key, the d-pad, the back key. I assumed that a WM Pro device with a keypad would operate in a similar manner. Unfortunately Microsoft created a very clear division between the two versions of Windows Mobile. Someone decided that WM Pro should be operated with a stylus and WM Std should be operated with keys.

Here’s the scenario: I setup email on both devices and received my gmail messages.

WM Std: Within Outlook Mobile, I navigate the list of messages with the up/dn arrow buttons and press ENTER to read the specific note. When finished reading the current note, I can press left/right to read the previous/next message or press BACK to return to the inbox list.

WM Pro: Within Outlook Mobile, I navigate the list of messages with the up/dn arrow buttons and press ENTER to read the specific note. When finished reading the current note, I can press left/right to read the previous/next message. I press the BACK key thinking that it will return me to the inbox, but it’s IGNORED. In order to leave the “message view” and go back to the “folder view”, I need to whip out the stylus and press the tiny OK button in the upper right corner of the Window. Pressing ACTION/ENTER doesn’t work either; that just selects the sender’s email address. I guess I can blame HTC for not including the necessary “OK” key.

I retraced my steps and tried other things, but there’s no avoiding it; WM Pro requires you to use the stylus in many scenarios; this is made worse by HTC not including the necessary soft menu and OK keys on the Touch and Touch Dual. Even if there were finger-friendly ways of working with it, I have a physical keypad and want to use it, but Microsoft/HTC won’t let me. I actually had hopes of using the Touch Dual as my main phone, but it’s unusable in it’s current form. The physical design is great (except for the lack of buttons). On-screen objects are small on my old 3.5″ Pocket PC screens, but they’re microscopic on the 2.6″ touchscreen of the Touch Dual. This is a deal-breaker for me. I just can’t see the logic behind forcing me to use a stylus to manipulate tiny on-screen objects when I’ve got a perfectly good keypad that I can operate with one hand. The other oddity of the Touch Dual is that when the keypad is exposed, the touchscreen becomes disabled. This doesn’t seem to be 100% consistent, but if I flip it open from a closed, suspended state, the touchscreen is disabled and all I can do is make a call. Very strange.

Anyone else feel the same way? Microsoft, are you listening? Perhaps WM 7 will take a smarter approach to input. Or require device manufacturers to include the necessary buttons to make the WM experience better on “Pro” devices.

December 6, 2008 Posted by bitbank | arm, arm9, omap, pocket pc, smartphone, wince, xscale | | No Comments Yet

A Graphics Library for Windows Mobile (could run on BREW, Symbian too)

The current environment for developing games and other graphics-intensive applications on Windows Mobile is somewhat lacking. For the simplest programs, the ability to copy bitmaps with transparency using the ImageList_xxxx API is probably sufficient, but for the rest of us, we have to re-invent the wheel. I’m currently working on a game project which is not an emulation of a classic game (rare for me), and I started out using the ImageList functions to draw some objects with transparency. After about 10 small on-screen objects, the performance slowed down to the point where I had to abandon that idea and start over. I have now written a simple graphics library in ARM assembly language that’s highly optimized and performs well enough to allow much more complex graphics. The library includes the following functions:

void BBGHLine(BBGFX_DC *pDC);
void BBGVLine(BBGFX_DC *pDC);
void BBGLine(BBGFX_DC *pDC);
void BBGFill(BBGFX_DC *pDC);
void BBGGradientFill(BBGFX_DC *pDC);
void BBGBlitTransparent(BBGFX_DC *pDC);
void BBGBlitColorSwap(BBGFX_DC *pDC);
void BBGBlitPattern(BBGFX_DC *pDC);
void BBGStretchBlit(BBGFX_DC *pDC);
void BBGRotate(BBGFX_DC *pDC, int iAngle);

The line and blit functions also include translucency. The rotate function can rotate a bitmap to any angle (0-359). Some of these things are done reasonably by Direct3D, but this app must run on PPC2003 as well as newer devices which don’t have any 2D/3D hardware assistance. I’m considering offering this for sale as a product, but I’m not sure how big a market there is. Please comment below if you need or have had to write such a library to support the graphics of your application.

November 26, 2008 Posted by bitbank | arm, arm9, asm, assembly language, graphics, optimization, performance, pocket pc, smartphone, tech, wince, xscale | , , , , , | 3 Comments

A good tool to save electricity

Here in Southern California, they have a very effective policy to encourage people to save electricity – the price increases exponentially after a certain “normal usage” allowance. The flip side of this is that by reducing electricity usage by a small amount, lots of money can be saved.

Many people assume that when a device is turned off that it’s not using electricity, but unfortunately that’s rarely the case. In the case of TV’s and computers, the device is partially powered up waiting to receive commands from the remote control or the network. For wall transformers and chargers, the power supply is not efficient and wastes energy even when nothing is attached. A good indicator that a wall charger is an inefficient model that’s wasting electricity is that it’s warm to the touch. Modern chargers stay cool since they don’t waste electricity as heat. A new Energy Star law was passed in California which took effect January 1, 2007. This law covers home electronics power supplies. When turned off or in standby mode, electronic devices can use no more than half a watt under the new law. This is a big improvement compared to the average device in use today. Here are some examples of existing devices’ power usage when turned off:

TV – 10-15 Watts
Computer – 10-20 Watts
Wall Charger – 5-10 Watts

If we assume that 1 Watt of wasted electricity costs about $1 per year:

365 days x 24hrs x 1/1000 w/kw x $0.12/kwh = $1.05 (with an average rate of 12 cents per kwh)

This can add up pretty quickly in a house with several devices always plugged in:
3 TVs + 2 Computers + 10 assorted wall chargers = ~$100 per year

This is just the electricity that’s truly wasted since the devices are not in use. Appliances left on all day and not used (e.g. office computers) waste even more. It’s difficult to guess how much electricity is being used by different appliances, so here’s a product which removes the guesswork:
Kill-a-watt

Here’s a link to a reliable vendor with a good price ($17.99):


P3 International P4400 Kill A WATT Electricity Load Meter and Monitor

The kill-a-watt measures the electricity usage of any 110V device; it shows you the current usage and allows you to measure the operating cost for up to 30 days for devices which turn on and off (e.g. refrigerators). For older electronics, it makes sense to use a power strip to stop them from wasting energy when you’re not using them. For computers (even older ones), it makes sense to set the power policy (in the Windows Control Panel) to set the computer to sleep when not in use for a certain period of time. I configured my new computer to sleep when not used for 15 minutes and according to the kill-a-watt meter, it uses only 1 Watt while sleeping.

October 16, 2008 Posted by bitbank | tech | , , | 3 Comments

Get your music without spending a bundle

Contrary to what Apple tries to make you believe, it is possible to find music and portable players that don’t cost a bundle.  I never liked the idea of buying music through the iTunes store simply because the audio quality is diminished (compared to a CD) and the music is restricted in how you can use it.  It always made more sense to me to buy the CD and then “rip” the music into your computer for use on portable devices.  Besides the higher quality audio, and no restrictions on its use, you can’t lose a CD due to accidental erasure or a hard drive crash.  The only problem with CD’s, besides Sony’s constant attempts to restrict their use, is the cost.  A typical new CD costs $12 to $18 both in retail stores and online.  The only lower cost option is to buy used CD’s.  Both Ebay and Amazon are good sources of used CD’s, but an even better store is a website called “just-the-disc”.  The CD’s they sell appear to be used and/or radio-demos. I’ve ordered many discs from them and they’re reliable.  The CD’s come in paper or plastic sleeves (no case nor cover art – hence the name: ‘Just The Disc’). All CD’s cost $2.99 each and if you buy 5 or more at a time, shipping is free.  Here’s the link to their site:

JustTheDisc

They don’t always have every CD you’re looking for, but out of the 300K+ CD’s that they carry, you can usually find a good number.

Now that the content part of the equation is solved, how about the portable player? Again, I’m not a real fan of Apple’s prices, but luckily there are many other manufacturers of portable music players. I have had pretty good luck with refurbished electronics of all types, so I took a chance with portable music players and found a good deal. Buy.com sells the SanDisk players and currently have an excellent deal on a tiny one:Sansa M250

This player has 2GB of built-in storage as well as an FM-radio and voice recorder. It handles MP3, WMA and Audible files. The current deal for a refurbished one (not sure how long this deal will last, but they’ve had similar deals for at least a year) is $14.99 with free shipping. I’ve purchased several of the M240 (1GB) models and have been very happy with them. Here’s the link to Buy.com’s deal page:


Sandisk Sansa m250 Digital Audio Player 2GB w/FM & Voice Recording – Recertified

October 11, 2008 Posted by bitbank | tech | , , , , , | No Comments Yet

Supermarket club cards are a waste of everyone’s time

I recently moved from Florida to California.  In Florida they have supermarket club cards in a few of the markets, but it hasn’t been taken to the extreme as it is here in California.  In Florida, Winn Dixie and Albertsons have discount cards and the difference between the regular price and “discounted” price is usually very little.  A typical shopping trip of $150 will yield a “savings” of $8.  The story is quite different in California.  Here, every supermarket uses club cards and has extremely inflated prices if you’re unfortunate enough not to use their card.  A typical shopping trip here costs $200 and a “savings” of $55.  The way I see it, club cards are a waste of everyone’s time and are also unfair to illiterate or lazy people.  In other words – if you have any sense, you’ll sign up for their discount card and use it (you can do it on your first trip).  This basically makes the whole idea of the cards a waste of time since everyone is forced to use them.  Another way of looking at it is that you’re allowed to pay normal prices if you use the card and pay the penalty if you don’t.  It probably started out as an arms race between the stores where they one-upped each other to offer “greater discounts” with their club cards.  At Ralphs they also have “reward” points which work like a 1% rebate on your purchases, but these expire every 3 months.  All marketing gimmicks and all quite annoying.

October 8, 2008 Posted by bitbank | personal | , , , | 1 Comment

Tiny JPEG

A potential customer approached me recently and had a need for a JPEG decoder to run on a system with very limited resources.  The exact requirements were that the system is based on an ARM7 CPU and the code needed to be smaller than 32K while using less than 16K of RAM.  My current code does not fit this requirement, but it is possible to change it and potentially not suffer any loss of performance.  My current code is rather large because it breaks out individual routines to handle all of the color subsampling options and sizing (e.g. full size, 1/2 size, thumbnail).  The RAM usage of my code is currently larger than 16K due to the clipping tables used in the pixel color conversion.  This may be a useful vertical market for my imaging library.  Do any of you have a need for a tiny JPEG decoder which is faster and uses less memory than libjpeg?

October 3, 2008 Posted by bitbank | arm, asm, optimization, pocket pc, smartphone, tech, wince | , , , , , | No Comments Yet

Windows Mobile 6 Phone Roundup

I’ve been using Windows Mobile phones since the early days of the MPX-200 and have used just about every phone that was released. For software testing, I’ve had to acquire the latest WM6 devices and have used them as my daily phone for minimum of several days. Here are my observations:

1) T-Mobile Shadow
Pros:
Excellent form factor – thin and light
Large, bright display
Good ergonomic keypad
Slide-up keyboard good for answering/hanging up
Cons:
Terrible battery life
Strange keypad layout causes slower text entry
Terrible camera
So-so phone reception

2) Motorola Q9H
Pros:

Built-in GPS
Large, bright display
Good phone reception
Fast CPU
Comes with extended battery
Decent keyboard
Cons:
TERRIBLE voice quality (sounds like talking to Darth Vader through a paper towel tube)
Heavy, bulky device
GPRS/EDGE data worked slowly and unreliably
Custom USB connector requires special cable or dongle

3) HTC Vox (S710)
Pros:

Good form factor for full-keyboard+keypad device
Large, bright display
Excellent numeric keypad
Excellent slide-out keyboard
Excellent voice quality
Excellent phone reception
Good GPRS/EDGE connectivity
Decent camera
Cons:
Little rubber covers warp and stick out (USB + MicroSD)

Conclusion:
The HTC Vox wins by a landslide. The only thing that kept me holding on to the Q9H for a few extra days was experimenting with the GPS, but since the EDGE connectivity was so hit or miss, I couldn’t get Google Maps to work because it kept timing out when receiving data. I guess the next phone for me will be the 3G successor of the Vox.

April 13, 2008 Posted by bitbank | pocket pc, smartphone, wince | | 2 Comments

More JPEG Optimization

I’ve been thinking more about JPEG decode optimization and have come up with some new ideas.  My latest goal is a fast image preview which works with EXIF thumbnail images.  I’ve been targeting Desktop Windows and so far, all of the code is written in C.  The latest experiment was on a Core 2 Duo T7250 (2.0Ghz) laptop.  The results of decompressing 500 EXIF (160×120) thumbnail images into 16bpp flat bitmaps resulted in an average decode time of 0.7 milliseconds per thumbnail image.  That works out to about 35 nanoseconds per pixel.  I used my same optimized C code from before, but this time I made better use of memory.  Maybe some good x86 asm can get it to go even faster…

March 22, 2008 Posted by bitbank | tech | , | 1 Comment