PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 5ms RepoModel.GetById 0ms app.codeStats 0ms

/Avc/paint_1.js

http://github.com/mbebenita/Broadway
JavaScript | 35 lines | 32 code | 3 blank | 0 comment | 2 complexity | 1aa514061c8640f407d594b9bdb3f094 MD5 | raw file
 1function _paint($luma, $cb, $cr, w, h) {
 2  for (var y1,y2,u,v,ruv,guv,buv,j,w_2=w>>1,W=w*4, surface=SDL.surfaces[SDL.screen], d=surface.image.data, r=0; h-=2;) {
 3    for (j=w_2; j--;) {
 4      u = IHEAP[$cr++];
 5      v = IHEAP[$cb++];
 6      ruv = 409*u-56992;
 7      guv = 34784-208*u-100*v;
 8      buv = 516*v-70688;
 9
10      y2 = IHEAP[$luma+w]*298;
11      y1 = IHEAP[$luma++]*298;
12      d[r+W] = y2+ruv>>8;
13      d[r++] = y1+ruv>>8;
14      d[r+W] = y2+guv>>8;
15      d[r++] = y1+guv>>8;
16      d[r+W] = y2+buv>>8;
17      d[r++] = y1+buv>>8;
18      r++;
19
20      y2 = IHEAP[$luma+w]*298;
21      y1 = IHEAP[$luma++]*298;
22      d[r+W] = y2+ruv>>8;
23      d[r++] = y1+ruv>>8;
24      d[r+W] = y2+guv>>8;
25      d[r++] = y1+guv>>8;
26      d[r+W] = y2+buv>>8;
27      d[r++] = y1+buv>>8;
28      r++;
29    }
30    r+=W;
31    $luma+=w;
32  }
33  surface.ctx.putImageData(surface.image, 0, 0 );
34}
35