Recent

Author Topic: TBRGAAnimatedGif irregular timing [Solved]  (Read 524 times)

BobT

  • New Member
  • *
  • Posts: 19
TBRGAAnimatedGif irregular timing [Solved]
« on: March 19, 2024, 02:41:32 pm »
I have a largish application which uses Timage components to display images as status indication for equipment that the application monitors. Some of these images are animated gifs to indicate an active or alarm condition. I have found that where a few tens of animated gifs are running, some of them show irregular animation, apparently stalling for one or more frame periods. The more animations are running, the more obvious the timing irregularities.

A test application attd with a single form and 28 Timages shows similar behaviour at both design and run time, while 21 TBGRASpriteAnimation components at the same time and on the same form operate normally.

This doesn't seem to be platform or o/s -specific. To a slightly varying degree the same thing happens in Linux, W7, and W10 (all 64 bit) and on different hardware platforms (HP Z400, HP 8750W, HP ZBOOK). On Linux I have Lazarus 2.2.2/ fpc 3.2.2; on Windows lazarus 2.2.6.




« Last Edit: March 20, 2024, 02:57:38 pm by BobT »

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: TBRGAAnimatedGif irregular timing
« Reply #1 on: March 20, 2024, 02:31:26 am »
Hello BobT,

Thanks for your feedback. It's great to see such a wide use of the animated GIF graphic.

I understand that with a number of these displayed at the same time, some animations are apparently stalled. As far as I understand, TBGRAAnimatedGif is designed to skip frames if they cannot all be drawn. In the context of blinking gifs, this can result in the frame being displayed, thus stalling the animation.

The component has been designed to not have too much priority to avoid freezing the interface. The drawback is that it can lead to less consistent timings.

TBGRASpriteAnimation do not have this issue because it doesn't skip frames and has a steady timer. It has a fixed delay between frames. If this component is fine for you, then it is probably the simplest way forward.

Otherwise, there may be a way though to tweak TBGRAAnimatedGif to reduce frame skipping by keeping the same timer interval throughout the GIF animation. This could be investigated.

Before going further, I would like to clarify. Would TBGRASpriteAnimation be a good fit for your application?

Regards
Conscience is the debugger of the mind

BobT

  • New Member
  • *
  • Posts: 19
Re: TBRGAAnimatedGif irregular timing
« Reply #2 on: March 20, 2024, 01:04:37 pm »
Hi Circular,

Many thanks for your response.

The main application, which was inherited from an earlier Delphi version, used plain Timage, so referencing TBGRAAnimatedGif was the simple and obvious way to implement gif animation. An unusually complex applied instance revealed this issue.

It looks to me that TBGRAAnimatedGif is adjusting frame periods to implement varyiing individual gif frame delays within the animation and also synchronise them with the system real time clock, which is a level of timing precision that is not needed for my application. I understand that the resulting timer period adjustments have a significant system overhead, which is presumably the underlying reason for the skipped frames.

I am pretty sure that TBGRASpriteAnimation should do exactly what I need and with less system overhead, so that is the way I intend to go.

With thanks again for your insight and advice, and the enormous contribution you have made with BGRA graphics in general. Very much appreciated.

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: TBRGAAnimatedGif irregular timing [Solved]
« Reply #3 on: March 20, 2024, 06:54:29 pm »
Hi BobT,

I am glad the answer I provided brought you clarity and hinted for a way forward. GIFs are indeed more versatile, providing extra features but also having some drawbacks. TBGRASpriteAnimation seems a reasonable choice for reliable indicators for your user interface.

I am always thrilled to see how BGRABitmap can bring neat graphics in various applications. Every question raised, even when showing a shortcoming, is an opportunity for me to celebrate how my work on the library can contribute.

Warm regards
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018