Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGL fallback #26

Closed
ssleptsov opened this issue Jan 21, 2014 · 10 comments
Closed

WebGL fallback #26

ssleptsov opened this issue Jan 21, 2014 · 10 comments

Comments

@ssleptsov
Copy link

Hi,
Is this correct that webGL need here only to convert YUV image to rgb, right?
So is it possible to convert it to rgb without webGL, by this it will be possible to draw image in 2D canvas, right?

Thanks.

    this.webGLCanvas.YTexture.fill(buffer.subarray(0, lumaSize));
    this.webGLCanvas.UTexture.fill(buffer.subarray(lumaSize, lumaSize + chromaSize));
    this.webGLCanvas.VTexture.fill(buffer.subarray(lumaSize + chromaSize, lumaSize + 2 * chromaSize));
    this.webGLCanvas.drawScene();
@mbebenita
Copy link
Owner

Yeah, WebGL is not needed. You can do the conversion in Canvas2D and use putImageData()

@ssleptsov
Copy link
Author

Any suggestion why I fail with conversion YUV(i420) to rgb and draw? I all the time get white canvas. Here is my post in stackoverflow http://stackoverflow.com/questions/21264648/javascript-convert-yuv-to-rgb
Thanks.

@mbebenita
Copy link
Owner

Here is some code that performs the conversion:

https://github.com/mbebenita/Broadway/blob/master/Decoder/paint_2.js

@ssleptsov
Copy link
Author

Thanks, last question is how to get Luma,cb,cr arrays from one array? any examples, can't find here?

@mbebenita
Copy link
Owner

Well in the code above, the luma, cb, cr arrays are allocated somewhere on the emscripten heap, and passed in as pointer arguments.

@ssleptsov
Copy link
Author

Hm..but how $cb and $cr can be arrays if then they have
u = HEAPU8[$cr++];
v = HEAPU8[$cb++];
or I miss something?

@mbebenita
Copy link
Owner

There's really only one large array, HEAPU8 that represents the entire emscripten heap. $cr and cb are integer offsets into that array that point to logical arrays (allocated by the C code using malloc).

@soliton4
Copy link
Collaborator

soliton4 commented Jan 7, 2015

@ssleptsov
@mbebenita
#44

@soliton4
Copy link
Collaborator

webgl auto detection and fallback solution works:
http://mbebenita.github.io/Broadway/storyDemo.html

@ssleptsov

@soliton4
Copy link
Collaborator

@ssleptsov hasnt been active for month

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants