[maemo-developers] Setting Up Ram Drive on N800?

From: Steve Polishinski nokia800 at titan.gotdns.com
Date: Mon Mar 26 08:21:28 EEST 2007
On Sunday 25 March 2007 20:37, Ed Okerson wrote:
> Steve,
> > It would be nice to have the write (2) and read (3) in RAM.  I toss the
> > TIFF file anyway.
> This is what Unix Pipes are created for.  Use the following command:
> dcraw -c crw_0001.crw | cjpeg > crw_0001.jpeg
> This pipes the output of dcraw into cjpeg instead of writing it to a file,
> cjpeg then writes a jpeg output file.  This will do everything you want in
> RAM.
> Ed Okerson

Thanks for the hints.  I pursued them and came to a few conclusions.

First, "convert" doesn't take input from the console, so I used a named pipe 
to fake it.

Nokia-N800-51:/home/user# mkfifo tiffy
Nokia-N800-51:/home/user# dcraw -c -h -T IMGP0100.PEF > tiffy &
Nokia-N800-51:/home/user# time convert tiffy -resize 640x480 out.jpg
real    1m 48.40s
user    0m 49.99s
sys     0m 3.84s
[1] + Done                       dcraw -c -h -T IMGP0100.PEF 1>tiffy

Which, depressingly, is only ~5 secs faster than not using pipes.
Or I am messing up the pipe useage here?

"Anywayz", I fetched the cjpeg source, which is part of yet another library.  
Cjpeg sure beats the heck out of "convert" for speed, but then it doesn't do 
the resize, but produces a similar size file.  It takes just a few secs 
to run.  

Nokia-N800-51:/home/user# time cjpeg IMGP0100.ppm > c.jpeg
real    0m 2.96s
user    0m 2.09s
sys     0m 0.21s
Nokia-N800-51:/home/user# ls -l
-rw-r--r--    1 root     root       206020 Mar 25 22:38 100b.jpeg
-rwxr--r--    1 root     root     13809502 Mar 25 15:52 IMGP0100.PEF
-rw-r--r--    1 root     root      7643969 Mar 25 23:37 IMGP0100.ppm
-rw-r--r--    1 root     root      7644888 Mar 25 22:36 IMGP0100.tiff

... which leads me to the conclusion that the SD Flash reading & writing does 
NOT take anywhere near the time I thought, since cjpeg is reading a very 
similarly sized 7.6 Meg file in only a few secs.... unless it's cached???

My new plan is to convert the RAW images to JPEG on the camera, and to use 
cjpeg to compress for web transfer on my N800.  The camera JPEG conversion is 
not at all automated, but quite workable.  The RAW images are not destroyed 
in the process.  I can resize to 640x480 after the web transfer.

Thanks, Steve

More information about the maemo-developers mailing list