Speeding up full screen image drawing on iPhone 3G - iphone

I am developing an app which plays interactive real time streaming video. I use FFMPEG (don't worry, I'll be releasing my source code) to decode a MPEG2/H264 RTP stream. I simply cannot get the iPhone 3G to draw a screen full of pixels faster than 5 times per second.
I've tried a OpenGL texture which was just a slow. I've also tried an array of 2D vertexes covering the entire screen and using glDrawArrays but that yielded 5 FPS as well. For now I've stuck to simply drawing a CGImage onto my view which gives me about 7-8 FPS.
From what I gathered, the private CoreSurface framework seems to be the only way. Anyone have any tips or tricks to get at least 20-30 FPS? I'd hate to restrict my app to only the 3GS and iPod touches.
Thanks,
Andrew

If you want to play H.264 and MPEG2 video on the iPhone, why are you doing the decoding yourself? What do you need that MPMoviePlayer doesn't cover?

If you are decoding in software, you're never going to get a good frame rate. Even on faster hardware (iPhone 3GS and 2nd/3rd gen iPod touches), you're going to drain the battery very quickly.

Related

Is it possible to programmatically capture iPhone 5S slow motion video?

I couldn't find an answer to this question, and looking at Apples own apps like iMovie on iOS, the video picker does not offer a slow motion option on the iPhone 5S.
The image picker offers very little control over the video. If you are willing to dive deeper into the APIs you can use AVFoundation to capture your video and manipulate the camera properties as you see fit.
iOS 7 introduces a new AVCaptureDeviceFormat class that will give you the maximum and minimum supported frame-rates for the capture device, and you can use these to set a custom frame rate on the camera itself. I don't have an iPhone 5S to hand so I can't actually verify whether this API goes all the way down to 120FPS.

Color-depth in iPhone simulator

I made a promotional video for my Exoplanet app and just noticed that the color-depth on the iPhone simulator is much lower than on the physical device. The visualizations look splendid on the actual phone but rather cheap on the simulator. I mainly notice this when using textures in OpenGL and CoreAnimation.
Have a look at this short video to see what I mean. (It has nothing to do with the recording.)
Am I doing something wrong? Can I increase the color-depth of the simulator?

App is fast on 3GS but slow on 3G

I'm new to computer coding and have just finished coding an app and tested it on both 3G and 3GS. On 3GS, it worked as normal as on the simulator. However, when I tried to run it on 3G, the app becomes extremely slow. I'm not sure what's the reason and I hope someone could shed some light on me.
Generally, my app has a couple of view controller classes, with one of them being the title page, one being the main page, one is setting, etc. I used a dissolve to transition from the title page to the main page. But even this simple transition shows un-smooth performance on a 3G! My other part of the app involves zooming in to some images by scaling up the images, switching images by push or dissolve upon receiving touch events, saving photos into photo library and storing and retrieving some photos in a folder and some data in a SQlite database, each showing un-smooth actions.
Compared with some heavy graphic or heavy maths app, I think mine is pretty simple. I totally have no clue why the app would behave so slow and un-smooth that it is barely useful on a 3G. Any help/ direction would be much appreciated. Thanks for helping out.
You might want to try profiling your application with Shark to find out where the performance bottlenecks are.
I don't know how relevant it is to your case, but my game (shameless plug) MultiMaze is quite undemanding graphically, and worked beautifully on my 3GS. But when I tried it on a 3G, the frame rate dropped to a glacial 10-20 fps. I ported the whole code base from CoreGraphics to OpenGL ES, and that made a world of difference. It now runs at the limit (60 fps) on my 3GS and very close to it on the 3G.
Are you using a lot of memory? 3G has 128MB while the 3GS has 256MB RAM.
Are you getting memory warnings? In my debug builds I have an NSLog in didReceiveMemoryWarning so I can see if/when I get warnings.
EDIT: Check the size of your photos, are they resized for the iPhone screen or are they original sized?
OK, finally found the problem and got the solution. The problem was that I have about a dozens of transparent images laying on each other to form my main view. So when in any animation, the system needs to redraw on every single layer and calculate their transparent effect and so on. (actually I'm not quite sure, but that's what I think)
The solution I have is to make a temporary composite view containing of them all, and placing the composite as an image in a full screen view before starting any animation. It delays starting the fade a moment, but the fade itself is a lot smoother now.

Can the iPhone simulator handle PVR textures?

I have a really weird problem with PVR textures on the iPhone simulator- the framerate falls through the floor on the iPhone simulator, but on the iPhone itself it works just fine. Has anyone had any experiences similar to this? I'm using SDK 3.1.2
The iPhone simulator is known to be extremely slow for certain rendering scenarios.
One especially bad case we experienced was that creating (glGenTextures+glTexImage2D) and destroying (glDeleteTextures) a big texture (title screen) will kill all performance until a hard simulator restart.
Testing your "logic" on the simulator and "assuming" it will be fast on the device has been working pretty good for us.
As always: Try avoiding state changes!
And yes: PVR textures are supported, but simulated in the shader.
Yes, simulator supports PVRTC textures, but probably does decompression into RGB format during upload or when texture is used for the first time. In my game it causes big slowdown until every PVR texture is shown at least once. Of course, those slowdowns appear in simulator only and on actual device PVRTC textures are very very fast.
The iPhone simulator is notorious about being almost like the iPhone.
I cannot speak about PVR textures, as I am not sure. But, from other things I have done (and from what I read on the internet) most developers give up on the simulator rather quickly due to its minor differences from the real thing.
In the end if it works on the iPhone, then the simulator doesn't matter.

Movie, Image Editing, Mixing Audio in IPhone

I need to develop some sort of application featuring Editing Movie slices, Adding and editing images, Adding sound . recording movie, Adding effects, setting transitions between movie clips and images.
so is there any provision in SDK 3.0? I will use iPhone 3GS
Please Help Me.
Thanks
Unfortunately, there isn't a lot of support for a program like this on the iPhone yet. With the 3GS and OS 3.0, your program can let the user record a video and trim it, but everything after that is left to you to do from scratch. You get the filename of the recorded video, but there are no OS calls to even do something as simple as find out how many seconds of video there are.