com.unity.webrtc
com.unity.webrtc copied to clipboard
[REQUEST]: Ability to commit YUV frame image data as a frame image.
Is your feature request related to a problem?
Nreal is equipped with a camera, and you can acquire the image of the camera in frame units, but at that time you can select whether to acquire it in RGB or YUV (420). (YUV data is acquired as a serialized one-dimensional byte array) If you select YUV, the memory usage will be reduced accordingly.
Also, in ARKit XR Plugin, if you get the frame image of the camera on iOS, it will be taken as a YUV image.
As you can see, depending on the SDK and assets, there are some scenes where images are acquired with YUV.
Inside Unity WebRTC, when passing a frame image to the (software) encoder, it seems that it is converted from RGB to YUV (420) before passing, so if YUV data can be committed as a frame image as it is, memory usage will be suppressed and RGB will be changed to YUV. I thought it would be possible to eliminate the conversion overhead of.
(翻訳が不安なので日本語のテキストも追加します) 先ほどのリクエストとほぼ同じですが、今回はYUV画像データをフレーム画像としてコミットする機能をリクエストします。
Nrealではカメラが搭載されており、カメラの映像をフレーム単位で取得することができるのですが、その際にRGBで取得するかYUV(420)で取得するかの選択ができます。 (YUVのデータは直列化した一次元byte配列で取得されます) YUVを選択すると、その分メモリ使用量が抑えられます。
また、ARKit XR Plugin においてもiOSでカメラのフレーム画像を取得するとYUV画像として取得されます。(AndroidではRGBです)
このようにSDKやアセットによっては、YUVで画像を取得する場面がいくつか見受けられます。
Unity WebRTC 内部では(ソフトウェア)エンコーダーにフレーム画像を渡すときにRGBからYUV(420)に変換してから渡してるみたいですので、YUVデータをそのままフレーム画像としてコミットできればメモリ使用量を抑えRGBからYUVへの変換するオーバーヘッドをなくすことができるのではと思った次第です。
Describe the solution you'd like
No response
Describe alternatives you've considered
No response
Additional context
No response
AR Foundation の YUV については XRCpuImage.GetPlane のことですか?
すいません。AR Foundation ではなく 正しくは ARKit XR Plugin の間違いでした。(リクエスト内容も修正しました) ARKit XR Plugin の場合、
ARTextureHandles handles = UnityARSessionNativeInterface.GetARSessionNativeInterface().GetARVideoTextureHandles();
とすることで、handles.textureY, handles.textureCbCr にそれぞれネイティブテクスチャのポインタが取得されます。
ありがとうございます。実際にどのくらい高速化できるか分かりませんが、試す価値はありそうです。
memo: WRS-237