bvibber / yuv-canvas

JS class to draw YUV image frame buffers to an HTML5 canvas
MIT License
273 stars 60 forks source link

YUV-to-RGB Conversion Shader #16

Closed f3z0 closed 7 years ago

f3z0 commented 7 years ago

The YUV to RGB colorspace conversion should ideally be a shader program and executed on the GPU. This should make 4K video resolution playback feasible. Here's a working OpenGL example http://www.fourcc.org/source/YUV420P-OpenGL-GLSLang.c. BTW, YUV-Canvas is great, many thanks.

f3z0 commented 7 years ago

Nevermind, looks like YCbCr.js isn't used.

bvibber commented 7 years ago

The WebGL shader is used when supported and yes it makes a big difference in performance. :) The in-JS conversion is used only if WebGL is unavailable (old browser versions or problematic video drivers) or explicitly disabled.