 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Erik Turner Guest
|
Posted: Sat Jun 19, 2004 10:22 pm Post subject: Question about JPEG decoding |
|
|
I have been playing around with developing a fast JPEG image file compare
tool.
I've pretty much decided on comparing 16x16x2bit grayscale "thumbnails" of
the images.
What I need to do is quickly create these 16x16x2bit grayscale thumbnails.
My current code converts the JPEG file to a 24 bit TBitmap and then uses the
ScanLine property to quickly access the memory buffer. For images in the
200KB-300KB range, I can achieve about 10-15 thumbnails a second.
I would like to do better than this if possible. Several things that I've
read indicate that the IJG library has been improved since Borland took a
snapshot (I'm using Delphi 5.0).
Does anyone know of an updated version of JPEG.PAS? Or a pascal interface
unit to the jpeg62.dll library?
Thanks,
Erik Turner
|
|
| Back to top |
|
 |
Joris Van Damme Guest
|
Posted: Sat Jun 19, 2004 10:31 pm Post subject: Re: Question about JPEG decoding |
|
|
"Erik Turner" <erik (AT) turner (DOT) org> wrote
| Quote: | What I need to do is quickly create these 16x16x2bit grayscale thumbnails.
My current code converts the JPEG file to a 24 bit TBitmap and then...
|
If memory serves, the IJG code is able to decode directly to grayscale, and
do that significantly faster compared to decoding to 24bit RGB (not even
counting the speed benefits from not having to convert to grayscale
afterwards). I'm not too sure though, I could be confusing with something
else.
Joris Van Damme
[email]info (AT) awaresystems (DOT) be[/email]
http://www.awaresystems.be
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html
|
|
| Back to top |
|
 |
Erik Turner Guest
|
Posted: Sat Jun 19, 2004 11:15 pm Post subject: Re: Question about JPEG decoding |
|
|
You are correct.
In fact, I set the GrayScale property just after I load the image and it
does
go faster. But it still produces a 32 bit/pixel TBitmap object. I still
think it
would be faster if the TBitmap wasn't involved at all.
Erik Turner
"Joris Van Damme" <PleaseReplyTo (AT) TheGroupInstead (DOT) be> wrote
| Quote: | "Erik Turner" <erik (AT) turner (DOT) org> wrote in message
news:40d4bcc3$1 (AT) newsgroups (DOT) borland.com...
What I need to do is quickly create these 16x16x2bit grayscale
thumbnails.
My current code converts the JPEG file to a 24 bit TBitmap and then...
If memory serves, the IJG code is able to decode directly to grayscale,
and
do that significantly faster compared to decoding to 24bit RGB (not even
counting the speed benefits from not having to convert to grayscale
afterwards). I'm not too sure though, I could be confusing with something
else.
Joris Van Damme
[email]info (AT) awaresystems (DOT) be[/email]
http://www.awaresystems.be
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html
|
|
|
| Back to top |
|
 |
Nils Haeck Guest
|
Posted: Sun Jun 20, 2004 8:14 pm Post subject: Re: Question about JPEG decoding |
|
|
Do you also use the TJpeg.Scale = jsEighth? That's a much higher improvement
than the grayscale thing.
I use it in my similarity check software ABC-View Manager:
http://www.abc-view.com/abcview.html
Kind regards,
Nils
"Erik Turner" <erik (AT) spamless (DOT) turner.org> wrote
| Quote: | You are correct.
In fact, I set the GrayScale property just after I load the image and it
does
go faster. But it still produces a 32 bit/pixel TBitmap object. I still
think it
would be faster if the TBitmap wasn't involved at all.
Erik Turner
"Joris Van Damme" <PleaseReplyTo (AT) TheGroupInstead (DOT) be> wrote in message
news:40d4be50 (AT) newsgroups (DOT) borland.com...
"Erik Turner" <erik (AT) turner (DOT) org> wrote in message
news:40d4bcc3$1 (AT) newsgroups (DOT) borland.com...
What I need to do is quickly create these 16x16x2bit grayscale
thumbnails.
My current code converts the JPEG file to a 24 bit TBitmap and then...
If memory serves, the IJG code is able to decode directly to grayscale,
and
do that significantly faster compared to decoding to 24bit RGB (not even
counting the speed benefits from not having to convert to grayscale
afterwards). I'm not too sure though, I could be confusing with
something
else.
Joris Van Damme
[email]info (AT) awaresystems (DOT) be[/email]
http://www.awaresystems.be
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html
|
|
|
| Back to top |
|
 |
Erik Turner Guest
|
Posted: Mon Jun 21, 2004 12:08 am Post subject: Re: Question about JPEG decoding |
|
|
I haven't tried the Scale property. I assumed that it would generate a bitmap that,
when stretched to 16x16, would be different than if I had stretched the original
image to 16x16. Is this not the case?
I want to use a very coarse thumbnail to do image similarity calculations.
It takes about 291 nsec to compare two 16x16x2bit thumbnails and produce the
"difference" metric (2.4GHz P4).
Now I'm more concerned with the time spent generating these coarse thumbnails.
I believe (and haven't verified) that the TJpegImage class generates a full size
grayscale bitmap and then StretchDraw's it to my 16x16 bitmap.
Erik Turner
BTW, I downloaded and installed your viewer and it's a pretty nice program.
"Nils Haeck" <n.haeckno (AT) spamchello (DOT) nl> wrote
| Quote: | Do you also use the TJpeg.Scale = jsEighth? That's a much higher improvement
than the grayscale thing.
I use it in my similarity check software ABC-View Manager:
http://www.abc-view.com/abcview.html
Kind regards,
Nils
"Erik Turner" <erik (AT) spamless (DOT) turner.org> wrote in message
news:40d4c91a$1 (AT) newsgroups (DOT) borland.com...
You are correct.
In fact, I set the GrayScale property just after I load the image and it
does
go faster. But it still produces a 32 bit/pixel TBitmap object. I still
think it
would be faster if the TBitmap wasn't involved at all.
Erik Turner
|
|
|
| Back to top |
|
 |
Joris Van Damme Guest
|
Posted: Mon Jun 21, 2004 1:04 pm Post subject: Re: Question about JPEG decoding |
|
|
"Erik Turner" <erik (AT) spamless (DOT) turner.org> wrote
| Quote: | I haven't tried the Scale property. I assumed that it would generate a
bitmap that,
when stretched to 16x16, would be different than if I had stretched the
original
image to 16x16. Is this not the case?
|
Depends on what you call 'different'. The result of decoding to an 1/8
downsample is *not* the same as just leaving pixels. It ressemles much more
a area averaging downsample. So I guess it may be suitable for your
purposes.
Joris Van Damme
[email]info (AT) awaresystems (DOT) be[/email]
http://www.awaresystems.be
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|