BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to read TJPEGImage faster?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics)
View previous topic :: View next topic  
Author Message
PC Hua
Guest





PostPosted: Mon Jan 05, 2004 12:10 am    Post subject: How to read TJPEGImage faster? Reply with quote



I put LoadFromFile in a TThread and running some actions with TTimer. I'm
having the problem that the TTimer routine is delayed if the JPEG file is
too huge. I was hoping that TThread could run independently.
If I use timeSetEvent() instead of TTimer would this help?
Any trick to load the JPEG file faster if I can't do it in background?

thanks
PC HUA


--
_/__/__/__/__/__/_
www.folksfun.com
Back to top
Detlef
Guest





PostPosted: Mon Jan 05, 2004 10:33 am    Post subject: Re: How to read TJPEGImage faster? Reply with quote



Hi PC HUA,
If I understand your problem, you read in the thread the image and you
somewhere else in your program, you are waiting for a timer. And the timer
does not occur.
What is the delay of the timer?
Do you test it with different priorities ( Priority is a property of
TThread) on the thread? Use the value tpLower for the thread.
At this time only some hints
Detlef

"PC Hua" <home-at-huaonline.dot.com> schrieb im Newsbeitrag
news:opr09z31jleb6hof (AT) newsgroups (DOT) borland.com...
Quote:
I put LoadFromFile in a TThread and running some actions with TTimer. I'm
having the problem that the TTimer routine is delayed if the JPEG file is
too huge. I was hoping that TThread could run independently.
If I use timeSetEvent() instead of TTimer would this help?
Any trick to load the JPEG file faster if I can't do it in background?

thanks
PC HUA


--
_/__/__/__/__/__/_
www.folksfun.com



Back to top
PC Hua
Guest





PostPosted: Mon Jan 05, 2004 10:00 pm    Post subject: Re: How to read TJPEGImage faster? Reply with quote



On Mon, 5 Jan 2004 11:33:33 +0100, Detlef <detlef.stute (AT) seatec-gmbh (DOT) com>
wrote:

Quote:
Hi PC HUA,
If I understand your problem, you read in the thread the image and you
somewhere else in your program, you are waiting for a timer. And the
timer
does not occur.
It does occur. The timer event come regularly (for updating the screen).

When the JPEG file is too huge you can see the delay (or skip) like video
missing frames.

Quote:
What is the delay of the timer?
Do you test it with different priorities ( Priority is a property of
TThread) on the thread? Use the value tpLower for the thread.
It's already set to tpIdle.


Phuoc Can HUA

--
_/__/__/__/__/__/_
www.folksfun.com

Back to top
Dennis Jones
Guest





PostPosted: Thu Jan 08, 2004 4:33 am    Post subject: Re: How to read TJPEGImage faster? Reply with quote


"PC Hua" <home-at-huaonline.dot.com> wrote

Quote:
On Mon, 5 Jan 2004 11:33:33 +0100, Detlef wrote:

Hi PC HUA,
If I understand your problem, you read in the thread the image and you
somewhere else in your program, you are waiting for a timer. And the
timer
does not occur.
It does occur. The timer event come regularly (for updating the screen).
When the JPEG file is too huge you can see the delay (or skip) like video
missing frames.

What is the delay of the timer?
Do you test it with different priorities ( Priority is a property of
TThread) on the thread? Use the value tpLower for the thread.
It's already set to tpIdle.

Your thread is probably executing a tight loop that is hogging all the CPU
time. You may need to modify (or re-design) your thread function so that it
gives up CPU time periodically so that other events, messages, etc., get a
chance to be processed by the OS while the thread is executing.

- Dennis



Back to top
Fishface
Guest





PostPosted: Thu Jan 08, 2004 4:44 pm    Post subject: Re: How to read TJPEGImage faster? Reply with quote

Dennis Jones wrote:
Quote:
Your thread is probably executing a tight loop that is hogging all
the CPU time. You may need to modify (or re-design) your thread
function so that it gives up CPU time periodically so that other events,
messages, etc., get a chance to be processed by the OS while the
thread is executing.

I could envision using a TMemoryStream, setting the Size, getting
a pointer to the buffer, and using an asynchronous (overlapped) API
ReadFile() to fill the buffer. The thread could then wait for the the
event to be signalled. Meanwhile, the main thread can run normally.
I'm not sure how much that would save, though. Probably much
of the time is spent decompressing the JPEG. The Intel library that
Sergio mentioned in the "Fast JPEG writing" thread might be faster,
as well...



Back to top
PC Hua
Guest





PostPosted: Thu Jan 08, 2004 11:23 pm    Post subject: Re: How to read TJPEGImage faster? Reply with quote

On Thu, 8 Jan 2004 08:44:41 -0800, Fishface <invalid (AT) ddress (DOT) ok?> wrote:

Quote:
Dennis Jones wrote:
I could envision using a TMemoryStream, setting the Size, getting
a pointer to the buffer, and using an asynchronous (overlapped) API
asynchronous (overlapped), what does that mean?


Quote:
ReadFile() to fill the buffer. The thread could then wait for the the
event to be signalled. Meanwhile, the main thread can run normally.
I'm not sure how much that would save, though. Probably much
of the time is spent decompressing the JPEG. The Intel library that
I think you are right because nowadays the HD is that fast and for <1MB it

shouldn't be a problem Sad I only hoped that I could get a bit improvement

But then what other trick can I use if my TJPEGImage::LoadFromFile is
already running in TThread (with tpIdle)?
I have tried to replace my TTimer (refreshing screen) with timeSetEvent. It
seems a little bit better (less interruptions by loading of image). But it
caused another problem. It interrupts another TThread which is running
music.

Quote:
Sergio mentioned in the "Fast JPEG writing" thread might be faster,
as well...
I was following that thread as well, but I think Sergio said that Borland

is faster. By the way, how do I use Intel's one? I assume TJPEGImage is
using Borland.

PC HUA




--
_/__/__/__/__/__/_
www.folksfun.com

Back to top
Fishface
Guest





PostPosted: Fri Jan 09, 2004 6:41 pm    Post subject: Re: How to read TJPEGImage faster? Reply with quote

PC Hua wrote:
Quote:
I think you are right because nowadays the HD is that fast and for
1MB it shouldn't be a problem Sad I only hoped that I could get
a bit improvement

But then what other trick can I use if my TJPEGImage::LoadFromFile
is already running in TThread (with tpIdle)?

I think it's still worth a try. How fast is the computer on which you are
testing and how quickly do you need to switch the images? What does
your screen refresh actually do? Are you using TImage to display?
Sounds like a slideshow or something...

Quote:
I was following that thread as well, but I think Sergio said that Borland
is faster. By the way, how do I use Intel's one? I assume TJPEGImage is
using Borland.

I thought he said Intel's was faster, but I'm not familiar with it. I think
Borland just used code from the IJG libraries. www.ijg.org



Back to top
PC Hua
Guest





PostPosted: Mon Jan 12, 2004 12:06 am    Post subject: Re: How to read TJPEGImage faster? Reply with quote

On Fri, 9 Jan 2004 10:41:22 -0800, Fishface <invalid (AT) ddress (DOT) ok?> wrote:

Quote:
But then what other trick can I use if my TJPEGImage::LoadFromFile
is already running in TThread (with tpIdle)?

I think it's still worth a try. How fast is the computer on which you
I'm think of an easier way to try, instead of modifying my codes, I want to

configure a RAM disk (Win98SE) just for testing. Do you know how to do
that?

Quote:
are
testing and how quickly do you need to switch the images? What does
your screen refresh actually do? Are you using TImage to display?
Sounds like a slideshow or something...
Yes, it's a kind of slide show (see [url]www.folksfun.com)[/url]. The refresh is

drawing text on the image which i don't want to be interrupted by the
loading of the next image. I don't mind to have a very slow image changing
rate if I can make sure that the text can be drawn smoothly. I tried with
TThread. But it doesn't seem to work as I want :-(

PC HUA



--
_/__/__/__/__/__/_
www.folksfun.com

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.