fast album art thumbnail handling like iTunes? - cocoa

Im working with a few guys on trying to develop an app that requires some thumbnail scrubbing to handle album and tv show / movie art work in a grid view..
Much like iTunes does! But were having some trouble with getting the grid view to match the speed and agility of iTunes.
Anyone have suggestions on what to use in Cocoa UI world to make this better or more like iTunes?
See video for comparison...first our app then iTunes...
https://files.me.com/teemujin/0l0bc7.mov
IF you were to build an iTunes clone... how would you go about it?

Too many instances of view... switched to draw rect and reduced those instances till the redraw for scaling and scrolling was much improved.

Related

Loading many images simultaneously causes Activity/Fragment to lag

I'm new to developping android TV applications. I am building a quizz game which needs a lot of images, videos, mp3 and gifs to show up simultaneously at a given time depending on the business logic of the game. I am using:
glide to show images / gifs (images are High Definition);
android Async and Handler / Thread / Runnable pattern to play sounds;
android video player to play videos (videos are High Definition);
nested RelativeLayout / LinearLayout to display the views;
View.setVisibility(GONE) to hide views and View.setVisibility(VISIBLE) to show it.
My problem is this:
On a Samsung galaxy tab 4 device, the game is smooth! But on a TV device, TCL 1920x1080 40dpi that should run the game, it is laggy.
I have read a lot of blog posts about how to optimize code ; like using ConstraintLayout instead of nested layouts, using View.setVisibility(INVISIBLE) instead of View.setVisibility(GONE) and I am also planning to use Picasso instead of Glide to get some fps but I'm not confident about all those. Can anyone give me advices on how to optimise my code to get some more fps (I mean getting like 10 or 15 fps not just 2 or 3)? Thanks in advance guys, cheer up!
in android manifest I added:
android:hardwareAccelerated="true"
solved the problem got 15fps higher.

What is the best way to display and apply filters to RAW images on macOS?

I am creating a simple photo catalogue application for macOS to see whether the latest APIs can significantly improve performance of loading directories with large numbers of images.
So far it looks pretty promising and loading around 600 45MB RAW image thumbnails using QLThumbnailGenerator and CGImageSourceCreateWithURL is super fast allowing thumbnail images and image metadata to be displayed almost instantly.
Displaying these images in a NSCollectionView using a CALayer in the NSCollectionViewItem's view also appears to be extremely fast and scrolling is very smooth.
I did find that QLThumbnailGeneratorseems to start failing after a few hundred images and starts returning error code 108 if I call the api in a continuous loop - I fixed that by calling CGImageSourceCopyPropertiesAtIndex immediately after the thumbnail generator api call - so maybe there is a timing issue or not enough file handles or something if the api is called to quickly and for too long.
However I am still having trouble rendering a full sized image to the display - here I am using a NSScrollView with a layer backed NSView documentView. Everything is super fast until the following call:
view.layer.contents = cgImage
And at this point the entire main thread hangs until the image has loaded - and this may take a few seconds.
Once it has loaded it's fine and zooming in and out by changing the documentView frame size is very fast - scrolling around the full size image is also super smooth without any of the typical hiccups.
Is there a way of loading these images without causing the UI to freeze ?
I've seen the recent WWDC2020 session where they demonstrate similar scrolling of large numbers of images but I haven't been able to find anything useful on loading large images other than CATiledLayer - but it's not really clear if that is the right answer for this problem.
The old Apple sample RawExpose seemed to be an option but most of that code is deprecated and it seems one has to use MetalKit not instead of GLKit - unfortunately there is no example of using MetaKit with Core Image that I can find.
FYI - I tried using some the new SwiftUI CollectionView and List but they seem to be significantly slower than AppKit and I found some of the collection view items never render - of course these could just be bugs in the macOS 11 beta.
OK - well I finally figured it out and it's complicated but simple. It's complicated because there are so many options to choose from and so many outdated sample apps to look at. In any event I think I have solved most if not all the issues related to using metal backed CALayers and rendering realtime updates of the images as CIFilter adjustments are applied. There are many pieces to the puzzle and happy to share if anyone is looking for help.
Some key pointers:
I am using CAMetalLayer and NSView
I override the CAMetalLayer.display(layer:) method and call the layer.setNeedsDisplay() when the user slides an adjustment slider.
I chain together all the CIFilters, including the RAW filter created with CIFilter(imageUrl:)
Most importantly I use the RAW filters scaleFactor parameter to size the image - encountered major performance issues using any other method to resize the image for the views size
Don't expect high performance if the image is zoomed right in - 50% is seems to be the limit for 45megapixel RAW imaged from Nikon D850.
A short video of the result is here https://youtu.be/5wp0CIWAoIM

HTML5 Fullscreen API & performance

I'm coding an app around video content and am currently playing around with HTML5's fullscreen API (I know it is still in very early stage).
Because of what my application does, the video itself isn't the only part that goes fullscreen: several elements alongside go fullscreen too, and I have noticed a great drop in performance there. The video streams ok, but other graphical elements suddenly get painfully slow. For example, a hover style typically takes about a good half second before showing up. A simple change in subtitles (I use popcorn.js) causes the video to freeze for a fraction of a second.
Any one knows why this is so? Do you experience the same? Thanks for your precious feedback.

Drawing large images for ipad

I am developing an application for viewing images.
I used the example of PhotoScroller Apple to implement this application.
In my application I want to be able to draw on the image.
I had the idea to put a UIView on top with transparent background and draw the lines via touch events. This solution has become very slow because the generated images are very large, around 3700x2000 pixels.
I also tried a solution with the example of Apple GLPaint that uses OpenGL, but it has a size limitation of 2048x2048 pixels.
Anyone have any idea or example of how I implement this?
I think you should try and tile your image.
One option is using CATiledLayer. Have a look at this short tutorial.
Or you could try and use CGContextDrawTiledImage to get your stuff done. Possibly this post from S.O. could help you getting started.

WP7: Creating a movie from bitmap images

I'm developing a WP7 app. I have a collection of BitmapImages that I load from the isolated storage.
Now I want to make a movie or animated GIF from those BitmapImages, is this possible? And if yes how?
An animated GIF is probably not possible because Silverlight does not work with gifs.
Yes Windows Phone 7 doesn't support animated GIFs. Here's a link to something similar that might be able to help you though:
Display GIFs in a Windows Phone 7 application
If you have a collection of images in isolated storage I'm guessing that you don't want to turn them into an animated gif on the phone anyway.
Just use a Timer to cycle through the images.
If you want greater control over the "playback" you could create an actual movie file but whether this is practical will depend on the images and how you get them into IS in the first place.
Using story board would be a good idea to create an animation. But the problem is how to export the animation. I have been thinking a solution for a long time.

Resources