• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Concurrent loading of images ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Concurrent loading of images ?


  • Subject: Re: Concurrent loading of images ?
  • From: Gabriel Zachmann via Cocoa-dev <email@hidden>
  • Date: Wed, 13 May 2020 22:34:06 +0200

>
> Care to post a video on a Google drive so that we can see it?

Good idea - here is the video:

  https://owncloud.informatik.uni-bremen.de/index.php/s/TTGG6bKCMFLqY4g

(encoded in H265/HEVC for saving file size)

I think, you can see clearly the stuttering. Sometimes it is more subtle,
sometimes, the stuttering pauses the animation for a second.
Sometimes, it occurs when the background thread is prefetching the next image
(usually happens directly after the switch to a new image), sometimes, it
happens when the new image is beginning to show (i.e., when it's CALayer is
added to the layer hierarchy).

I made another experiment, which puzzles me even more.
I am storing a history of the CGImageRef's that had been displayed so far.
When I go back through that history, I use those stored CGImageRef's to create
new CALayers which I then add to the layer hierarchy (the image that had been
shown until then is just removed from the layer hierarchy, or rather its
CALayer).
The funny thing is that when I do that (using older CGImageRef's) the switch
from one image to the next one is instantaneous and there is no stuttering at
all.

You can see that in the video starting at 1:19.

It seems as if some more processing is going on when a CGImage is assigned to a
CALayer,
which CGImageSourceCreateThumbnailAtIndex() and all the other functions I
listed below do not do.
Or it happens at the point when an animation is added.
And the result of that is stored inside the CGImage!
But how can I force that in the background thread?
(without making the animation of the foreground thread stutter.)

I made another little experiment.
I keep (kinetically) scrolling through the source code in Xcode with high
velocity while my app is running in the foreground.
And when it switches images there is sometimes even a stuttering in that
scrolling.

>
> One of my tricks (not just mine) is to have a 3 slots of for images, not just
> 2.  When a new image loads, take the foreground one that is blended in to
> 100%, put an identical one ahead of it.  Make the changes to the new and old
> images behind it, then hide that foreground image.

Sorry, I didn't get how that would work with my animations.
Maybe, you can describe it again once you've seen the video.



Best, Gab.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Concurrent loading of images ?
      • From: Alex Zavatone via Cocoa-dev <email@hidden>
    • Re: Concurrent loading of images ?
      • From: Alex Zavatone via Cocoa-dev <email@hidden>
References: 
 >Concurrent loading of images ? (From: Gabriel Zachmann via Cocoa-dev <email@hidden>)
 >Re: Concurrent loading of images ? (From: Jens Alfke via Cocoa-dev <email@hidden>)
 >Re: Concurrent loading of images ? (From: Rob Petrovec via Cocoa-dev <email@hidden>)
 >Re: Concurrent loading of images ? (From: Gabriel Zachmann via Cocoa-dev <email@hidden>)
 >Re: Concurrent loading of images ? (From: Jens Alfke via Cocoa-dev <email@hidden>)
 >Re: Concurrent loading of images ? (From: Gabriel Zachmann via Cocoa-dev <email@hidden>)
 >Re: Concurrent loading of images ? (From: Alex Zavatone via Cocoa-dev <email@hidden>)

  • Prev by Date: Re: Concurrent loading of images ?
  • Next by Date: Re: Concurrent loading of images ?
  • Previous by thread: Re: Concurrent loading of images ?
  • Next by thread: Re: Concurrent loading of images ?
  • Index(es):
    • Date
    • Thread