• aleksandar.stojiljkovic's avatar
    Lossless access to 16-bit video stream using WebGL GL_FLOAT texture. · d851a930
    aleksandar.stojiljkovic authored
    If using canvas.getImageData or GL textures of UNSIGNED_BYTE type, 16-bit depth
    stream data is available only through 8-bit* API, so there is a precision loss.
    Here, we add no-precision-loss** JavaScript access through WebGL float texture.
    
    RGBA32F usage here enables lossless access to 16-bit depth information via WebGL1.
    In related work, the same code path is used to upload 16-bit data to other WebGL2
    supported formats; e.g. with GL_R16UI there is no conversion needed in
    SkCanvasVideoRenderer::TexImageImpl.
    
    * 8-bit access refers to JS ImageData and WebGL UNSIGNED_BYTE where 16-bit depth
    data is now available as luminance (all 3 color channels contains upper 8 bits
    of 16bit value).
    
    ** Float is used for no-precision-loss access to 16-bit data normalized to
    [0-1.0] range using formula value_float = value_16bit/65535.0.
    
    This patch also adds UNSIGNED_BYTE WebGL test which was earlier tested through
    testVideoToImageBitmap since UNSIGNED_BYTE and canvas rendering still share the
    same path through SkCanvasVideoRenderer::Paint.
    
    BUG=369849, 624436
    CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
    
    Review-Url: https://codereview.chromium.org/2476693002
    Cr-Commit-Position: refs/heads/master@{#436221}
    d851a930
webmediaplayer_ms.cc 23.8 KB