Solved

For duke_n

Posted on 1998-09-16
6
152 Views
Last Modified: 2010-04-06
Hi

Based on your proposed answer to roosiedb (Jan van Barchum) about Picture-formats other than BMP.
Reading JPG file is much slower than reading BMP file. Why ?
Do you have any solution to make it faster ?

Joely
0
Comment
Question by:joely
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1339851
decompression algorithm takes more operations (depending on compression rate).

Black Death.
0
 
LVL 1

Expert Comment

by:duke_n
ID: 1339852
I've got no idea, but if BlackDeath says so...
It's pretty stisfying explanation...
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1339853
well:

jpeg (joint photographics experts group) is a compression method designed by this group, not a format.

e.g. the file formats tiff and jfif use this compression method.

mostly jfif is referred to as jpeg and named *.jpg or *.jpeg.

now - the point is, to display a bmp you just gotta decode the header and bring it up to screen.

to display a jpeg-compressed jfif or tiff, you gotta decompress first, then decode the respective header and then bring it to screen. the higher the compression rate, the longer decompression lasts.

the latter one takes more operations, depending on compression rate.

if you wanna have information on picture compression and formats, take a look at the following sites:

http://members.aol.com/judinorth/gifs.book/jpegs/jpeg.html
http://members.aol.com/jnfbooks/gifs.html

- they're really informative.

have a nice day,

Black Death.

p.s.: i do not know any way to display jpeg-compressed pictures faster then bitmaps...


0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Accepted Solution

by:
Jacco earned 50 total points
ID: 1339854
BlackDeath:

>>the higher the compression rate, the longer decompression lasts.

joely:

This is entirely not true. The higher the compression rate (you loose more color information) The less information there is to decompress. So actually it is faster.

The compression used by the JPG file format is a rather complex one. Compressing and decompressing can take quite long. This all is because it uses a Fourier Transform method to reduce the information. This transformation inclodus sine and cosinus math. So there goes your speed. The transformation is done on square pixel blocks for each color spectrum (red green blue). The information is aranged in a way that the least important information for the eye is represented by as low as possible numbers (a lot become zero if the compression is not lossless). The result is the runlength encoded (special kind don't remember). Because of all the zeros at the end of (the information that is least important for the eye) is compressed very good. (i.e. 20x0 is smaller then 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0).

Now you understand why jpg is slower. BMP just contains straight forward (optionally only runlength encoded) information.

You cannot write a jpg encoder/decoder yourself. Way to complex!! But there is one included with delphi and there is jpegpas or jpegpas10 (you can find it on the most important Delphi sites). Maybe (i don't know) this library is faster then the one included with Delphi. Try it out.

But loading/displaying a bitmap will ALWAYS be faster.

Regards Jacco
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1339855
hi jacco!

i have to confess:
you're absolutely right concerning decompression time.
i've tested with a big bitmap, which i converted 3 times to jpg:
1st with 0%   compression
2nd with 50%  compression
3rd with 100% compression
i saved them as x000.jpg, x050.jpg, x100.jpg.
only silly thing i did was to not read the dialog:
below it said: "picture quality" and not "compression ratio".
so i interpreted the times i measured completely the wrong way round.
(which i didn't even wonder about, because with file compression my interpretation would have fit, so i didn't think about it any longer)

i apologize for the wrong information and feel very awful about it.

i hope you pardon me for this crap.

have a nice day,

Black Death.

0
 

Author Comment

by:joely
ID: 1339856
Quite a good explanation.
Thank's.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question