Closed astojilj closed 5 years ago
@astojilj Ability to use raw media for machine learning in an efficient manner seems important. Can we add something general to that effect as a requirement, or do we need to be specific?
@astojilj Can you prepare a PR for discussion at the June Virtual Interim?
@astojilj Can you review the changes to see if they are to your liking?
PR merged; if inadequate, please reopen.
Let's consider current data flow in processing video stream on GPU: getUserMedia() => WebGLRenderingContext.texImage2D(HTMLVideoElement) => processing in WebGL shaders.
An example for this is in TensorFlow.js - after video frame is uploaded to texture, processing is done on GPU under fenceSync - once the sync is signaled as ready, data can be read back to CPU without blocking.
While there is a security concern related to mapping buffers that GPU writes to, we can save a copy in WebGLRenderingContext.texImage2D(HTMLVideoElement) - if raw data buffer is shared GPU memory buffer.
I don't think that the engine should do this by default - it could be implemented by hinting to capture pipeline that the raw data will be used on GPU.