24
Multicore Media Graphics 3.0 2011716日土曜日

Abc2011 2 yagi

Embed Size (px)

Citation preview

Page 1: Abc2011 2 yagi

だけじゃない! Honeycomb

Multicore MediaGraphics

3.0

2011年7月16日土曜日

Page 2: Abc2011 2 yagi

Who am I ?

⼋八⽊木  俊広  TOSHIHIRO  YAGI

http://visible-true.blogspot.com/

@sys1yagi

Market:

Blog:

Twitter:

2011年7月16日土曜日

Page 3: Abc2011 2 yagi

High-performace 2D and 3D

http://www.flickr.com/photos/bistrosavage/1313589/

2011年7月16日土曜日

Page 4: Abc2011 2 yagi

what’s new

Animation Framework

Hardware Accelerated 2D Graphics

View support for hardware and software layers

RenderScript 3D Graphics Engine

2011年7月16日土曜日

Page 5: Abc2011 2 yagi

Animation Frameworkまったく新しいアニメーションフレームワーク

android.animationパッケージが追加された

(100,100)

(300,200)

ValueAnimator duration:1000 from:0 to:100

AnimationUpdateListener onAnimationUpdate(ValueAnimator animator){ value = (Float)animator.getAniamtionValue(); x = initialX + (value*2); y = initialY + value; invalidate(); }

2011年7月16日土曜日

Page 6: Abc2011 2 yagi

Hardware accelerated 2D Graphics

• AndroidManifest.xmlに設定するだけで、2D処理においてハードウェアアクセラレーションを利用できる。

<application android:hardwareAccelerated=”true” />

<activity android:hardwareAccelerated=”true” />

OpenGLレンダラがいい感じにしてくれる

2011年7月16日土曜日

Page 7: Abc2011 2 yagi

View support for hardware and software layers

• View単位での細かいレイヤ設定ができる。setLayerType(int)

LAYER_TYPE_HARDWARE

LAYER_TYPE_SOFTWARE• ソフトウェアでレンダリング。Bitmapでキャッシュ

• ハードウェアでレンダリング。OpenGLでキャッシュ

各レイヤのメリットにあわせて細かく制御

2011年7月16日土曜日

Page 8: Abc2011 2 yagi

RenderScript 3D Graphics Engine

ライブ壁紙Youtube

2011年7月16日土曜日

Page 9: Abc2011 2 yagi

android.renderscript• ハイパフォーマンスな3Dレンダリング• C言語に似たスクリプト言語• オブジェクトコードを生成する方式なので異なるCPU,GPUでも動作

RenderScriptファイル

RenderScriptの中間コード

A.rs

A.bc

ScriptC_A.java

RenderScriptに対するアクセサ

llvm-rs-cc.exeでビルド

A.d

RenderScriptのヘッダのようなもの

2011年7月16日土曜日

Page 10: Abc2011 2 yagi

Support for multicore processor architecture

http://www.flickr.com/photos/mccheek/1471251914/

2011年7月16日土曜日

Page 11: Abc2011 2 yagi

Support for multicore processor architecture

Android3.0からマルチコアがサポート

Dalvik VMやBionicライブラリが修正され、マルチコア環境での非同期処理が性能アップ

シングルスレッドでもマルチコアの恩恵が受けられる。

2011年7月16日土曜日

Page 12: Abc2011 2 yagi

実験1スレッド 2スレッド

2011年7月16日土曜日

Page 13: Abc2011 2 yagi

同試験で処理回数を3回、4回でやった場合

追試

HTC-Desire Optimus Pad3回 95294msec 33803msec4回 125017msec 43280msec

2011年7月16日土曜日

Page 14: Abc2011 2 yagi

Rich multimedia and Conectivity

http://www.flickr.com/photos/krayker/2268587409/

2011年7月16日土曜日

Page 15: Abc2011 2 yagi

what’s newTime lapse video

Texture support for image stream

HTTP live streaming

EXIF data

Camcorder profiles

Digital rights management (DRM)

2011年7月16日土曜日

Page 16: Abc2011 2 yagi

Time lapse video• MediaRecoderで動画撮影をする際にsetProfile(CamcorderProfile)でタイムラスプ用のプロファイルを設定し、setCaptureRate(double fps)でレートを指定するだけ。

MediaRecorder recoder = new MediaRecorder();recoder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);

recoder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_TIME_LAPSE_480P));recoder.setCaptureRate(fps);

recoder.setOutputFile(Environment.getExternalStorageDirectory().getAbsolutePath() + "/test.mp4");recoder.setPreviewDisplay(holder.getSurface());recoder.prepare();recoder.start();

2011年7月16日土曜日

Page 17: Abc2011 2 yagi

Texture support forimage stream

• OpenGLのテクスチャに、カメラやメディアのストリームを表示できる。

こ、こんな感じ?

カメラのプレビュー

OpenGLの世界

2011年7月16日土曜日

Page 18: Abc2011 2 yagi

HTTP live streaming• HTTP live streaming draft protocolをサポート• m3uのURLをMediaPlayerなどに与えると再生できる。

らしい。

2011年7月16日土曜日

Page 19: Abc2011 2 yagi

しかし

2011年7月16日土曜日

Page 20: Abc2011 2 yagi

動かず・・・!

path = "http://std1.ladio.net:8060/i-j-y-u-i-n--.m3u";

mMediaPlayer = new MediaPlayer();mMediaPlayer.setDataSource(path);mMediaPlayer.setDisplay(holder);mMediaPlayer.prepare();mMediaPlayer.setOnBufferingUpdateListener(this);mMediaPlayer.setOnCompletionListener(this);mMediaPlayer.setOnPreparedListener(this);mMediaPlayer.setOnVideoSizeChangedListener(this);mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);

2011年7月16日土曜日

Page 21: Abc2011 2 yagi

EXIF data• レンズの口径(TAG_APERTURE)

• 露光時間(TAG_EXPOSURE_TIME)

• ISO感度(TAG_ISO)

android.media.ExifInterface

2011年7月16日土曜日

Page 22: Abc2011 2 yagi

Camcorder profilesAdded Fields Added Methods

boolean hasProfile(int) boolean hasProfile(int, int)

int QUALITY_1080Pint QUALITY_480Pint QUALITY_720Pint QUALITY_CIFint QUALITY_QCIFint QUALITY_TIME_LAPSE_1080Pint QUALITY_TIME_LAPSE_480Pint QUALITY_TIME_LAPSE_720Pint QUALITY_TIME_LAPSE_CIFint QUALITY_TIME_LAPSE_HIGHint QUALITY_TIME_LAPSE_LOWint QUALITY_TIME_LAPSE_QCIF

プロファイルのサポートや、各種プロファイルを取得する為の定数が追加された。

2011年7月16日土曜日

Page 23: Abc2011 2 yagi

Digital rights management (DRM)

• Javaのレイヤから利用可能な統一的なAPI

• 端末に組み込まれたDRMプラグインを利用できる。

プラグインは端末メーカーが乗せます。3.0のOptimus Padには何も入ってませんでした。3.1のXOOMではWidevine DRM plug-inが入っていました。

2011年7月16日土曜日

Page 24: Abc2011 2 yagi

だけじゃなかった! Honeycomb

GraphicsAnimation FrameworkHardware Accelerated 2D and 3DView support for hardware and software LayersRenderScript 3D Graphics Engine

Multi coreSupport for multicore processor architecture

MediaTime lapse videoTexture support for image streamHTTP live streamingEXIF dataCamcorder profilesDigital rights management (DRM)

3.0

2011年7月16日土曜日