?
Solved

For duke_n

Posted on 1998-09-16
6
Medium Priority
?
153 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 10

Accepted Solution

by:
Jacco earned 150 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

Industry Leaders: 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!

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month11 days, 17 hours left to enroll

752 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