Follow-on fix for bug 457825. Use sheet principal for agent and user sheets. r=dbaron...
[wine-gecko.git] / media / liboggplay / yuv2rgb-vanilla-fix.patch
blobf23c6b7646d5ff758447ab15501bedd83e42c6e5
1 Index: oggplay_yuv2rgb.c
2 ===================================================================
3 --- oggplay_yuv2rgb.c (revision 3733)
4 +++ oggplay_yuv2rgb.c (working copy)
5 @@ -357,29 +357,27 @@
6 ptro2 = ptro;
7 for (j = 0; j < yuv->y_width; j += 2) {
9 - short pr, pg, pb;
10 + short pr, pg, pb, y;
11 short r, g, b;
13 - //pr = ((128 + (ptrv[j/2] - 128) * 292) >> 8) - 16; /* 1.14 * 256 */
14 - pr = (-41344 + ptrv[j/2] * 292) >> 8;
15 - //pg = ((128 - (ptru[j/2] - 128) * 101 - (ptrv[j/2] - 128) * 149) >> 8)-16;
16 - // /* 0.395 & 0.581 */
17 - pg = (28032 - ptru[j/2] * 101 - ptrv[j/2] * 149) >> 8;
18 - //pb = ((128 + (ptru[j/2] - 128) * 520) >> 8) - 16; /* 2.032 */
19 - pb = (-70528 + ptru[j/2] * 520) >> 8;
20 + pr = (-56992 + ptrv[j/2] * 409) >> 8;
21 + pg = (34784 - ptru[j/2] * 100 - ptrv[j/2] * 208) >> 8;
22 + pb = (-70688 + ptru[j/2] * 516) >> 8;
24 - r = ptry[j] + pr;
25 - g = ptry[j] + pg;
26 - b = ptry[j] + pb;
27 + y = 298*ptry[j] >> 8;
28 + r = y + pr;
29 + g = y + pg;
30 + b = y + pb;
32 *ptro2++ = CLAMP(r);
33 *ptro2++ = CLAMP(g);
34 *ptro2++ = CLAMP(b);
35 *ptro2++ = 255;
37 - r = ptry[j + 1] + pr;
38 - g = ptry[j + 1] + pg;
39 - b = ptry[j + 1] + pb;
40 + y = 298*ptry[j + 1] >> 8;
41 + r = y + pr;
42 + g = y + pg;
43 + b = y + pb;
45 *ptro2++ = CLAMP(r);
46 *ptro2++ = CLAMP(g);
47 @@ -409,29 +407,27 @@
48 ptro2 = ptro;
49 for (j = 0; j < yuv->y_width; j += 2) {
51 - short pr, pg, pb;
52 + short pr, pg, pb, y;
53 short r, g, b;
55 - //pr = ((128 + (ptrv[j/2] - 128) * 292) >> 8) - 16; /* 1.14 * 256 */
56 - pr = (-41344 + ptrv[j/2] * 292) >> 8;
57 - //pg = ((128 - (ptru[j/2] - 128) * 101 - (ptrv[j/2] - 128) * 149) >> 8)-16;
58 - // /* 0.395 & 0.581 */
59 - pg = (28032 - ptru[j/2] * 101 - ptrv[j/2] * 149) >> 8;
60 - //pb = ((128 + (ptru[j/2] - 128) * 520) >> 8) - 16; /* 2.032 */
61 - pb = (-70528 + ptru[j/2] * 520) >> 8;
62 + pr = (-56992 + ptrv[j/2] * 409) >> 8;
63 + pg = (34784 - ptru[j/2] * 100 - ptrv[j/2] * 208) >> 8;
64 + pb = (-70688 + ptru[j/2] * 516) >> 8;
66 - r = ptry[j] + pr;
67 - g = ptry[j] + pg;
68 - b = ptry[j] + pb;
69 + y = 298*ptry[j] >> 8;
70 + r = y + pr;
71 + g = y + pg;
72 + b = y + pb;
74 *ptro2++ = CLAMP(b);
75 *ptro2++ = CLAMP(g);
76 *ptro2++ = CLAMP(r);
77 *ptro2++ = 255;
79 - r = ptry[j + 1] + pr;
80 - g = ptry[j + 1] + pg;
81 - b = ptry[j + 1] + pb;
82 + y = 298*ptry[j + 1] >> 8;
83 + r = y + pr;
84 + g = y + pg;
85 + b = y + pb;
87 *ptro2++ = CLAMP(b);
88 *ptro2++ = CLAMP(g);