Skip navigation
Currently Being Moderated

my pain Experience of ios programing

Apr 26, 2012 2:12 PM

Tags: #ios;

hi ,guys

 

     we JUST using AIR 3.2 make  a  very very  very very  simple thing.-----------------------  "Picture displaying"

 

    Ok ,i  have 1600  pictures , 1024x768 pixels  . want to displayed on  IPAD2.

 

    guys,  u might suggest me make these as a  swf file .so ,we can gotoandstop.  Unfortunately, I cannot import more than 500 pictures into Flash CS 5&5.5 , it just crashed,crashed on X32/X64 platform with  8G/16G/32G ram . IT Crashed ?? Can u believe it's a "business "  product???..   this is  my first PAIN.

 

   As an older programmer . i  throw the flash CS away .then ,back to my old way before ..  make frame  sequence.. Using Pure AS3 ..i first load all my 1600 pictures into  IPAD2 memory as a  bytearray vector, it's cost  180M  ram . and IPAD2 have about 50m  free mem  left.. SO ,let's writ code to decode  jpeg file. ..load.loadbytes ,addeventlistener. bitmapdata.copypixel ....then .my second pain..AIR3.2 spend at least 35ms  to decode a 1024x768 pixel jpeg file with  60fps...IF U use 30fps, it  need at least 62ms..  I really really really very angry and very disappointed. SO ..u can guess,the FPS to display a frame  sequence animation  on  ios is only 7-10 fps.....only  7-10 fps....7-10fps ...guys ,i can't believe it . untill today , i  cann;t believe..is it a language???  is it  produced by adobe?? produced by a leading company familian with CG  technology???

 

   So, guys ,u spend many time to improve the  encode perfomance . that's a great thing .BUT ..can u improve decode performance??dare u??

 

   Also ..i test the "stage3D" with Starling framework ...same result ..So ,it's so clear ,decode  performance make everythings slow.

 

   Guys, u r doing great things . using AIR, i can compile once, run 3+ platforms...BUT .can u make it really?? make it like a  "Business" product, not only a " toy" for artist? make it like a  "adobe product"?

 

 

  And about  New function ----  usb debugging ios  ----------- no diffrence for me.  u buy an IPAD / IPHONE ..u must have a witi network .especially developer . SO ..debug via USB ,or  debug via network ,it's not a question ..U r  wasting time.

 

  As a  coder, i  only need  stable first ,fast  second   product.

 

and  next time ,i will tell u my  third pain  --------------------  using URLLoader  / URLStream  to load a file on  IOS will  crash app accidentally.

 
Replies
  • Currently Being Moderated
    May 3, 2012 3:42 AM   in reply to Adama-China

    Hi Adama,

     

    1600 images sounds a lot of data. The memory consumption that you are stating sounds incorrect. Would it not be the uncompressed data instead? Should it not be 1600*1027*768*4 (or 3) bytes since they would get uncompressed and get loaded in the memory. This would amount to around 4GB of memory which sounds impractical.

     

    For reducing the time to decompress you can consider lower quality jpegs as they have quicker decoding times. I would recommend you to read http://www.cocoanetics.com/2011/10/avoiding-image-decompression-sickne ss/ & http://www.cocoanetics.com/2012/03/ipad-3-image-decompression-benchmar ked/. It benchmarks the decoding time taken on various iOS devices for an image that is of same size as that of your use case. Your best attempt would be to reduce the number of images along with their resoltuin and use texture atlas to store multiple images on a large texture.

     

    Regarding your views on usb debugging on iOS I do understand that most developers would have a wi-fi network but again this feature was requested by many other developers. It is a good to have feature.

     

    -Kshitiz

     
    |
    Mark as:
  • Currently Being Moderated
    May 6, 2012 6:41 PM   in reply to Adama-China

    Hi Adama,

     

    You should try to be less rude when asking for help. It is always possible that your problems are caused by you not understanding the tools rather than the tools being at fault. And for the record, as someone who works in a wide variety of WiFi networks, USB debugging is much more conveniant for me than having to deal with constantly change IP addresses.

     

    All that said, have you tried decoding more than one JPEG at the same time - you may find that the completion events for multiple images happen on the same frame, in which case with some thought you should be able to achieve a faster display frame rate.

     

    If you need a fast 1024x768 playback framerate, have you considered using a video file instead of 1600 JPEGs ?

     

    Another option would be to write an iOS native extension that uses the iOS SDK JPEG decoder to synchronously decode your image.

     

    Dave

     
    |
    Mark as:
  • Currently Being Moderated
    May 6, 2012 9:23 PM   in reply to DavidQHogan

    I just did some tests and was wrong about event handling in general being related to the frame rate - I was making that assumption based on observing that if I call a function on a server over RTMP, and that server function calls a function on the client in response, on a 1 FPS swf the response on the client is executed 1 second after the request. However, doing the following results in a trace entry every 30ms, regardless of the swf FPS:

     

    setInterval(
         function():void
         {
              dispatchEvent(new Event("DAVE"));
         },
         30);
    addEventListener("DAVE", function():void { trace("TICK"); });
    

     

     

    I still think it's worth trying decoding a few images concurrently, though.

     
    |
    Mark as:
  • Currently Being Moderated
    May 6, 2012 11:13 PM   in reply to Adama-China

    Hi Adama,

     

    Could you mail your sources to kshgupta@adobe.com? You need not send the images. Just send any one image that you feel could show the symptom. I would like to run some tests.

     

    -Kshitiz

     
    |
    Mark as:
  • Currently Being Moderated
    May 7, 2012 3:22 AM   in reply to Adama-China

    Hi Adama,

     

    I have a few more questions regarding your usecase and the general discussion around jpeg decoding times.

     

    1) I noted that the decoding time for a 1024 x 768 sized image came around 60ms on an iPhone 4. These times were very similar to the benchmarks that have been done on Iphone4 using native code. Reference:http://www.cocoanetics.com/2012/03/ipad-3-image-decompression-benchmar ked

    If you are aware of some different benchmarks for jpeg decoding I will be very eager to look into the results

    2) With an image taking 60ms for the decode time you will get something like 10-15 fps which seems to be good enough for a slide show sort of use case. You might actually want longer delays a slide show (a slide staying visible for a couple of seconds). However, if you want more fps you might need a different type of container. Possibly a video that is being played by using StageVideo. You may read upon the following http://stackoverflow.com/questions/2997296/ipad-full-screen-1024x768-a nimation-with-around-1800-frames-problem-low-fps. It looks like a thread similar to what you are trying to achieve.

    Flash uses native implementation for jpeg decoding so I expect the numbers of decoding to be more or less similar to what you see natively.

     
    |
    Mark as:
  • Currently Being Moderated
    May 7, 2012 5:48 AM   in reply to kshi.gupta

    Adama - I no longer recommend that you try decoding more than one JPEG at once ..

     

    Kshitiz - I was suprised to read that decoding took that long, so verified it myself.

     

    Benchmark results here: http://pastebin.com/28nAdR8a

     

    What you are looking at is the result of multiple runs of:

     

    1. Take 1024x768 bitmap snapshot from an as3 Video attached to the local camera

    2. Measure encode using air native extension http://pastebin.com/VS1jhKB8

    3. Measure decode using air native extension http://pastebin.com/ez3BqEUB

     

    I'm kind of amazed - the native encoder is only roughly 20% slower than the decoder at quality 0.6! Does that mean Apple has heavily-optimised their encoder (hardware accelerated?) or is this a characteristic of the jpeg format? In a past life as the author of a VoIP stack, I grew accustomed to audio encoding with non-trivial codecs taking longer than decoding (since encoding typically involves analysis, whereas decoding does not)

     

    A nice outcome for me in doing this research is that i've now come across FRESetArrayLength(), so I can update my native encoder to not require a passed-in byte array with enough space.

     

    Dave

     
    |
    Mark as:
  • Currently Being Moderated
    May 12, 2012 5:36 PM   in reply to Adama-China

    I haven't developed any audio processing native extensions, however it would be pretty easy to compile some existing G.729 C source and hook it up via ANE to the microphone sample data event. Biggest issue for G.729 is having to license it, Speex makes a lot more sense so long as you have a transcoding server somewhere to provide interoperability. Especially if you support 16kHz audio, the quality is well worth the bandwidth for pure VoIP calls.

     

    If you were looking to do an Air VoIP client, you might as well do all the VoIP stack stuff in a native entension and just use Air for controlling it via an ANE interface. That way you might be able to leverage the native iOS echo canceller as well.

     

    For the record, I was wrong to think that FRESetArrayLength() could be used on a ByteArray - you simply need to set the length property. I have no idea why that didn't work for me when I originally tried it - perhaps I had acquired it at the time.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points