Unity3d+Cocoa Integration Test 02 (encode Image data as base64 string)

preview_player
Показать описание
At the beginning, I was worry the speed of the base64 encoding & decoding, but finally, I found that the bottleneck are the LoadImage() of Unity and other image rescaling issue.

The load image process takes quite long of time for importing the bytes array onto texture. it is almost 10 times slower than the base64 decoding itself XD

The following logs are generated from the above test, a modified AVCam demo from Apple, with 1024 x 1024 pixel texture.

[console log]
//---- pre-process in cocoa
15:50:59.857 base64EncodedString start
15:50:59.880 UIImage resize start
15:51:00.843 UIImage resize end
15:51:01.483 base64EncodedString end

//---- run inside unity
15:51:01.524 mono_runtime_invoke() start
15:51:01.633 Convert.FromBase64String(b64_string):0.07697487sec
15:51:02.480 LoadImage(b64_bytes) : 0.8373709sec
15:51:02.502 mono_runtime_invoke() end

[original sample code]

[base64 encoding]

[mono callback]
Рекомендации по теме
welcome to shbcf.ru