annotate Modules/yuvconvert.c @ 79675:c0a2294de787 2.7

Issue #16199: Backport 2to3 typo fix from 3.2.
author Chris Jerdonek <chris.jerdonek@gmail.com>
date Thu, 11 Oct 2012 16:15:46 -0700
parents fd25030223b0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1253
diff changeset
1
1253
685b31fe89c6 Added conversion routines to sv module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2 #include "yuv.h"
685b31fe89c6 Added conversion routines to sv module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3
685b31fe89c6 Added conversion routines to sv module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
4 void
685b31fe89c6 Added conversion routines to sv module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
5 yuv_sv411_to_cl422dc(int invert, void *data, void *yuv, int width, int height)
685b31fe89c6 Added conversion routines to sv module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
6 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
7 struct yuv411 *in = data;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
8 struct yuv422 *out_even = yuv;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
9 struct yuv422 *out_odd = out_even + width / 2;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
10 int i, j; /* counters */
1253
685b31fe89c6 Added conversion routines to sv module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
11
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
12 for (i = height / 2; i--; ) {
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
13 for (j = width / 4; j--; ) {
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
14 YUV422_Y0(*out_even) = YUV411_Y00(*in);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
15 YUV422_U0(*out_even) = YUV411_U00(*in);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
16 YUV422_V0(*out_even) = YUV411_V00(*in);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
17 YUV422_Y1(*out_even) = YUV411_Y01(*in);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
18 out_even++;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
19 YUV422_Y0(*out_even) = YUV411_Y02(*in);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
20 YUV422_U0(*out_even) = YUV411_U02(*in);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
21 YUV422_V0(*out_even) = YUV411_V02(*in);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
22 YUV422_Y1(*out_even) = YUV411_Y03(*in);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
23 out_even++;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
24 YUV422_Y0(*out_odd) = YUV411_Y10(*in);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
25 YUV422_U0(*out_odd) = YUV411_U10(*in);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
26 YUV422_V0(*out_odd) = YUV411_V10(*in);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
27 YUV422_Y1(*out_odd) = YUV411_Y11(*in);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
28 out_odd++;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
29 YUV422_Y0(*out_odd) = YUV411_Y12(*in);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
30 YUV422_U0(*out_odd) = YUV411_U12(*in);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
31 YUV422_V0(*out_odd) = YUV411_V12(*in);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
32 YUV422_Y1(*out_odd) = YUV411_Y13(*in);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
33 out_odd++;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
34 in++;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
35 }
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
36 out_even += width / 2;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
37 out_odd += width / 2;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
38 }
1253
685b31fe89c6 Added conversion routines to sv module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
39 }
685b31fe89c6 Added conversion routines to sv module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
40
685b31fe89c6 Added conversion routines to sv module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
41 void
685b31fe89c6 Added conversion routines to sv module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
42 yuv_sv411_to_cl422dc_quartersize(int invert, void *data, void *yuv,
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
43 int width, int height)
1253
685b31fe89c6 Added conversion routines to sv module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
44 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
45 int w4 = width / 4; /* quarter of width is used often */
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
46 struct yuv411 *in_even = data;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
47 struct yuv411 *in_odd = in_even + w4;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
48 struct yuv422 *out_even = yuv;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
49 struct yuv422 *out_odd = out_even + w4;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
50 int i, j; /* counters */
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
51 int u, v; /* U and V values */
1253
685b31fe89c6 Added conversion routines to sv module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
52
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
53 for (i = height / 4; i--; ) {
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
54 for (j = w4; j--; ) {
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
55 u = YUV411_U00(*in_even);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
56 v = YUV411_V00(*in_even);
1253
685b31fe89c6 Added conversion routines to sv module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
57
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
58 YUV422_Y0(*out_even) = YUV411_Y00(*in_even);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
59 YUV422_U0(*out_even) = u;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
60 YUV422_V0(*out_even) = v;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
61 YUV422_Y1(*out_even) = YUV411_Y02(*in_even);
1253
685b31fe89c6 Added conversion routines to sv module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
62
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
63 YUV422_Y0(*out_odd) = YUV411_Y10(*in_odd);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
64 YUV422_U0(*out_odd) = u;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
65 YUV422_V0(*out_odd) = v;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
66 YUV422_Y1(*out_odd) = YUV411_Y12(*in_odd);
1253
685b31fe89c6 Added conversion routines to sv module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
67
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
68 in_even++;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
69 in_odd++;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
70 out_even++;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
71 out_odd++;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
72 }
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
73 in_even += w4;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
74 in_odd += w4;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
75 out_even += w4;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
76 out_odd += w4;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
77 }
1253
685b31fe89c6 Added conversion routines to sv module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
78 }
685b31fe89c6 Added conversion routines to sv module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
79
685b31fe89c6 Added conversion routines to sv module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
80 void
685b31fe89c6 Added conversion routines to sv module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
81 yuv_sv411_to_cl422dc_sixteenthsize(int invert, void *data, void *yuv,
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
82 int width, int height)
1253
685b31fe89c6 Added conversion routines to sv module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
83 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
84 int w4_3 = 3 * width / 4; /* three quarters of width is used often */
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
85 int w8 = width / 8; /* and so is one eighth */
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
86 struct yuv411 *in_even = data;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
87 struct yuv411 *in_odd = in_even + width / 2;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
88 struct yuv422 *out_even = yuv;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
89 struct yuv422 *out_odd = out_even + w8;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
90 int i, j; /* counters */
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
91 int u, v; /* U and V values */
1253
685b31fe89c6 Added conversion routines to sv module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
92
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
93 for (i = height / 8; i--; ) {
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
94 for (j = w8; j--; ) {
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
95 u = YUV411_U00(in_even[0]);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
96 v = YUV411_V00(in_even[0]);
1253
685b31fe89c6 Added conversion routines to sv module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
97
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
98 YUV422_Y0(*out_even) = YUV411_Y00(in_even[0]);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
99 YUV422_U0(*out_even) = u;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
100 YUV422_V0(*out_even) = v;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
101 YUV422_Y1(*out_even) = YUV411_Y00(in_even[1]);
1253
685b31fe89c6 Added conversion routines to sv module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
102
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
103 YUV422_Y0(*out_odd) = YUV411_Y00(in_odd[0]);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
104 YUV422_U0(*out_odd) = u;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
105 YUV422_V0(*out_odd) = v;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
106 YUV422_Y1(*out_odd) = YUV411_Y00(in_even[1]);
1253
685b31fe89c6 Added conversion routines to sv module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
107
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
108 in_even += 2;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
109 in_odd += 2;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
110 out_even++;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
111 out_odd++;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
112 }
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
113 in_even += w4_3;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
114 in_odd += w4_3;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
115 out_even += w8;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
116 out_odd += w8;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 14375
diff changeset
117 }
1253
685b31fe89c6 Added conversion routines to sv module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
118 }