ios - How to read and render 30+ (60 is the goal of course) 1.5-megapixel images per second? (even on iPhone 4) -


i'm working on image app users can take photos , "scrub" through them. scrubber uislider , users move thumb left right, full-screen stored images display. there can hundreds of images , want scrubbing experience lag-free.

so far, here's i've done. if know of these not efficient, please tell.

1) store low-res (about 40% quality) jpeg version of each photo in separate db table photolowquality. hear may better off storing files , putting filepath in database? high-res images in 1 branch of code, haven't tested performance difference yet.

2) store full-res photos 85% jpegs, resized 1.5 megapixel (1500x1000) (since iphone screen not 1 mp). leave bit of room them zoom in, don't need type of app.

3) when users scrub through photos, , it's fast (last photo displayed less 0.1 seconds ago, example), serve low-quality version first , kick off timer pulls high-quality version of photo 0.1 seconds later. when users keep scrolling, see low-version pics (you can barely tell difference, though) , slow down enough or stop, see full-res pic near-instantly.

4) cache photos nscache, i'd rather have 30+ fps right away rather after first passthrough. plus noticed nscache crash app due not releasing memory in low-memory conditions fast enough, despite documentation saying does.

to read photos, use:

[uiimage imagewithcontentsoffile:photocoredataentity.filename]; 

this works pretty smooth on iphone 5. not on iphone 4. don't have multithreading yet - still trying figure out best way fit in. example, if put every image read request in nsoperation, can cancel previous operation when user scrubs next photo, cancel in middle of reading or wait till it's done reading, kind of making whole idea pointless? maybe need read bytes steam on own , check cancelled flag regularly...

any solve problem appreciated! thank you

while there may more efficient ways of loading image, did performance need combination of caching, loading lower-quality image first , replacing full-quality images, etc., , wrote post it. enjoy!


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -