Saqoosha

Starling Framework vs BitmapData.copyPixels

BlogFlash

Flash Player 11 の GPU レンダリング機能 (Stage3D) をつかって従来の DisplayObject を高速化してみようなフレームワーク、Starling Framework。どんぐらい変わるのかのベンチマークっぽいこと(どこかでみたことのあるアレ)をしてみたのだけど、逆に遅い。


  • exp01: Starling Framework つかったやつ。CPU 使用率 100% こえる。30 fps いくかいかないか。ふらふら。

  • exp02: BitmapData.copyPixel つかったやつ。CPU 使用率 30% ぐらい。もちろん、30 fps コマ落ちなし。

  • ソースとか


プロファイルしてみたところ、VertexData の更新が負荷高いぽいので、まあ、使い方がアレなんだろうなー、でも、こういうのって GPU 得意そうなんだけど。

・・・

9/28 12:00 追記:別の Stage3D 用 2D フレームワーク(ややこしい)ND2D で組んでみたら、すげえ軽くなった。


9/28 21:00:同じことしてるひといた。

Categories: Flash

Comments (7)

  • valyard
    exp3 with fp11 tells me that I don't have fp installed )8
  • focus
    Same issue for the exp03 =\
  • alumican_net
    うちの環境だと exp02 >>>>> exp01 ≒ exp03 でStage3Dの利点を感じられなかった(>3<)
  • maru
    One little optimisation you coul do in the Starling example is to reuse the same textures for all your MovieClips > I think it would save a lot of process and memory !

    Maybe you should try this :

    var tex:TextureAtlas = new TextureAtlas(Texture.fromBitmap(new AtlasTexture()), XML(new AtlasXML()));
    
    // one unique textures Vector for all MC
    var textures:Vector. = tex.getTextures();
    for (var i:int = 0; i < 1000; i++) {
    var mc:MovieClip = new MovieClip(textures, 30);
    mc.currentFrame = Math.random() * 30;
    mc.pivotX = 40;
    mc.pivotY = 70;
    mc.x = Math.random() * 1280;
    mc.y = Math.random() * 700;
    addChild(mc);
    Starling.juggler.add(mc);
    _mcs.push(mc);
    }
  • Thibault Imbert
    Yes, Maru is right.
  • Saqoosha
    > valyard, focus
    I forgot to upload swfobject, please try it again.

    > alumican_net
    たぶんグラフィックカードが対応してないとかでソフトウエアレンダリングなってるんじゃないかしら。trace(context3D.driverInfo) してみるよろし。

    > Maru, Thibault
    I tried but couldn't find any difference...
    TextureAtlas.getTexture returns just Vector of texture references, so it would not use a lot of memory I think.
  • [...] Saqoosha :: Starling Framework vs BitmapData.copyPixels [...]

Flash だけで音声認識してみるテスト

Blog

おんせいにんしきーっていうワードが聞こえてきたので、ちょっと時間あったので、オープンソースの Julius っていう音声認識エンジンAlchemy つかって Flash に移植してみましたです。いちおう使えるレベルだけど、やっぱ遅いなー。まあ、死んでると思ってた Alchemy も Adobe が本気で開発すすめるみたいなので、そのうちもっとましになるじゃろ。

Julius for Flash のテストこつら


  • 初期化おわるまでまつ。(辞書ファイルがでかい)

  • PLAY で聞く、RECOGNIZE で認識テスト。

  • LOAD WAV FILE で任意の WAV ファイル認識させてみる。(16KHz 16bit モノラルしかダメ)

  • さすがに NHK ニュースの認識率は高い。

  • ソース一式。(コンパイルするのはむずいかも)


C/C++ で書いてあるライブラリでも、Flash には Alchemy、AIR には ANE、Chrome に Native Client てかんじで Web でも意外といろいろ使える気がする。