~ubuntu-branches/ubuntu/maverick/python2.7/maverick-proposed

« back to all changes in this revision

Viewing changes to Modules/yuvconvert.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-06-29 00:57:00 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20100629005700-fz6zs37e3uv26o82
Tags: 2.7~rc2-1
* Python 2.7 release candidate 2.
* Update to 20100628, taken from the trunk.
* Merge packaging changes from python2.6 (2.6.5+20100628-1).

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
void
5
5
yuv_sv411_to_cl422dc(int invert, void *data, void *yuv, int width, int height)
6
6
{
7
 
        struct yuv411 *in = data;
8
 
        struct yuv422 *out_even = yuv;
9
 
        struct yuv422 *out_odd = out_even + width / 2;
10
 
        int i, j;               /* counters */
 
7
    struct yuv411 *in = data;
 
8
    struct yuv422 *out_even = yuv;
 
9
    struct yuv422 *out_odd = out_even + width / 2;
 
10
    int i, j;                   /* counters */
11
11
 
12
 
        for (i = height / 2; i--; ) {
13
 
                for (j = width / 4; j--; ) {
14
 
                        YUV422_Y0(*out_even) = YUV411_Y00(*in);
15
 
                        YUV422_U0(*out_even) = YUV411_U00(*in);
16
 
                        YUV422_V0(*out_even) = YUV411_V00(*in);
17
 
                        YUV422_Y1(*out_even) = YUV411_Y01(*in);
18
 
                        out_even++;
19
 
                        YUV422_Y0(*out_even) = YUV411_Y02(*in);
20
 
                        YUV422_U0(*out_even) = YUV411_U02(*in);
21
 
                        YUV422_V0(*out_even) = YUV411_V02(*in);
22
 
                        YUV422_Y1(*out_even) = YUV411_Y03(*in);
23
 
                        out_even++;
24
 
                        YUV422_Y0(*out_odd) = YUV411_Y10(*in);
25
 
                        YUV422_U0(*out_odd) = YUV411_U10(*in);
26
 
                        YUV422_V0(*out_odd) = YUV411_V10(*in);
27
 
                        YUV422_Y1(*out_odd) = YUV411_Y11(*in);
28
 
                        out_odd++;
29
 
                        YUV422_Y0(*out_odd) = YUV411_Y12(*in);
30
 
                        YUV422_U0(*out_odd) = YUV411_U12(*in);
31
 
                        YUV422_V0(*out_odd) = YUV411_V12(*in);
32
 
                        YUV422_Y1(*out_odd) = YUV411_Y13(*in);
33
 
                        out_odd++;
34
 
                        in++;
35
 
                }
36
 
                out_even += width / 2;
37
 
                out_odd += width / 2;
38
 
        }
 
12
    for (i = height / 2; i--; ) {
 
13
        for (j = width / 4; j--; ) {
 
14
            YUV422_Y0(*out_even) = YUV411_Y00(*in);
 
15
            YUV422_U0(*out_even) = YUV411_U00(*in);
 
16
            YUV422_V0(*out_even) = YUV411_V00(*in);
 
17
            YUV422_Y1(*out_even) = YUV411_Y01(*in);
 
18
            out_even++;
 
19
            YUV422_Y0(*out_even) = YUV411_Y02(*in);
 
20
            YUV422_U0(*out_even) = YUV411_U02(*in);
 
21
            YUV422_V0(*out_even) = YUV411_V02(*in);
 
22
            YUV422_Y1(*out_even) = YUV411_Y03(*in);
 
23
            out_even++;
 
24
            YUV422_Y0(*out_odd) = YUV411_Y10(*in);
 
25
            YUV422_U0(*out_odd) = YUV411_U10(*in);
 
26
            YUV422_V0(*out_odd) = YUV411_V10(*in);
 
27
            YUV422_Y1(*out_odd) = YUV411_Y11(*in);
 
28
            out_odd++;
 
29
            YUV422_Y0(*out_odd) = YUV411_Y12(*in);
 
30
            YUV422_U0(*out_odd) = YUV411_U12(*in);
 
31
            YUV422_V0(*out_odd) = YUV411_V12(*in);
 
32
            YUV422_Y1(*out_odd) = YUV411_Y13(*in);
 
33
            out_odd++;
 
34
            in++;
 
35
        }
 
36
        out_even += width / 2;
 
37
        out_odd += width / 2;
 
38
    }
39
39
}
40
40
 
41
41
void
42
42
yuv_sv411_to_cl422dc_quartersize(int invert, void *data, void *yuv,
43
 
                                 int width, int height)
 
43
                                 int width, int height)
44
44
{
45
 
        int w4 = width / 4;     /* quarter of width is used often */
46
 
        struct yuv411 *in_even = data;
47
 
        struct yuv411 *in_odd = in_even + w4;
48
 
        struct yuv422 *out_even = yuv;
49
 
        struct yuv422 *out_odd = out_even + w4;
50
 
        int i, j;               /* counters */
51
 
        int u, v;               /* U and V values */
52
 
 
53
 
        for (i = height / 4; i--; ) {
54
 
                for (j = w4; j--; ) {
55
 
                        u = YUV411_U00(*in_even);
56
 
                        v = YUV411_V00(*in_even);
57
 
 
58
 
                        YUV422_Y0(*out_even) = YUV411_Y00(*in_even);
59
 
                        YUV422_U0(*out_even) = u;
60
 
                        YUV422_V0(*out_even) = v;
61
 
                        YUV422_Y1(*out_even) = YUV411_Y02(*in_even);
62
 
 
63
 
                        YUV422_Y0(*out_odd) = YUV411_Y10(*in_odd);
64
 
                        YUV422_U0(*out_odd) = u;
65
 
                        YUV422_V0(*out_odd) = v;
66
 
                        YUV422_Y1(*out_odd) = YUV411_Y12(*in_odd);
67
 
 
68
 
                        in_even++;
69
 
                        in_odd++;
70
 
                        out_even++;
71
 
                        out_odd++;
72
 
                }
73
 
                in_even += w4;
74
 
                in_odd += w4;
75
 
                out_even += w4;
76
 
                out_odd += w4;
77
 
        }
 
45
    int w4 = width / 4;         /* quarter of width is used often */
 
46
    struct yuv411 *in_even = data;
 
47
    struct yuv411 *in_odd = in_even + w4;
 
48
    struct yuv422 *out_even = yuv;
 
49
    struct yuv422 *out_odd = out_even + w4;
 
50
    int i, j;                   /* counters */
 
51
    int u, v;                   /* U and V values */
 
52
 
 
53
    for (i = height / 4; i--; ) {
 
54
        for (j = w4; j--; ) {
 
55
            u = YUV411_U00(*in_even);
 
56
            v = YUV411_V00(*in_even);
 
57
 
 
58
            YUV422_Y0(*out_even) = YUV411_Y00(*in_even);
 
59
            YUV422_U0(*out_even) = u;
 
60
            YUV422_V0(*out_even) = v;
 
61
            YUV422_Y1(*out_even) = YUV411_Y02(*in_even);
 
62
 
 
63
            YUV422_Y0(*out_odd) = YUV411_Y10(*in_odd);
 
64
            YUV422_U0(*out_odd) = u;
 
65
            YUV422_V0(*out_odd) = v;
 
66
            YUV422_Y1(*out_odd) = YUV411_Y12(*in_odd);
 
67
 
 
68
            in_even++;
 
69
            in_odd++;
 
70
            out_even++;
 
71
            out_odd++;
 
72
        }
 
73
        in_even += w4;
 
74
        in_odd += w4;
 
75
        out_even += w4;
 
76
        out_odd += w4;
 
77
    }
78
78
}
79
79
 
80
80
void
81
81
yuv_sv411_to_cl422dc_sixteenthsize(int invert, void *data, void *yuv,
82
 
                                   int width, int height)
 
82
                                   int width, int height)
83
83
{
84
 
        int w4_3 = 3 * width / 4; /* three quarters of width is used often */
85
 
        int w8 = width / 8;     /* and so is one eighth */
86
 
        struct yuv411 *in_even = data;
87
 
        struct yuv411 *in_odd = in_even + width / 2;
88
 
        struct yuv422 *out_even = yuv;
89
 
        struct yuv422 *out_odd = out_even + w8;
90
 
        int i, j;               /* counters */
91
 
        int u, v;               /* U and V values */
92
 
 
93
 
        for (i = height / 8; i--; ) {
94
 
                for (j = w8; j--; ) {
95
 
                        u = YUV411_U00(in_even[0]);
96
 
                        v = YUV411_V00(in_even[0]);
97
 
 
98
 
                        YUV422_Y0(*out_even) = YUV411_Y00(in_even[0]);
99
 
                        YUV422_U0(*out_even) = u;
100
 
                        YUV422_V0(*out_even) = v;
101
 
                        YUV422_Y1(*out_even) = YUV411_Y00(in_even[1]);
102
 
 
103
 
                        YUV422_Y0(*out_odd) = YUV411_Y00(in_odd[0]);
104
 
                        YUV422_U0(*out_odd) = u;
105
 
                        YUV422_V0(*out_odd) = v;
106
 
                        YUV422_Y1(*out_odd) = YUV411_Y00(in_even[1]);
107
 
 
108
 
                        in_even += 2;
109
 
                        in_odd += 2;
110
 
                        out_even++;
111
 
                        out_odd++;
112
 
                }
113
 
                in_even += w4_3;
114
 
                in_odd += w4_3;
115
 
                out_even += w8;
116
 
                out_odd += w8;
117
 
        }
 
84
    int w4_3 = 3 * width / 4; /* three quarters of width is used often */
 
85
    int w8 = width / 8;         /* and so is one eighth */
 
86
    struct yuv411 *in_even = data;
 
87
    struct yuv411 *in_odd = in_even + width / 2;
 
88
    struct yuv422 *out_even = yuv;
 
89
    struct yuv422 *out_odd = out_even + w8;
 
90
    int i, j;                   /* counters */
 
91
    int u, v;                   /* U and V values */
 
92
 
 
93
    for (i = height / 8; i--; ) {
 
94
        for (j = w8; j--; ) {
 
95
            u = YUV411_U00(in_even[0]);
 
96
            v = YUV411_V00(in_even[0]);
 
97
 
 
98
            YUV422_Y0(*out_even) = YUV411_Y00(in_even[0]);
 
99
            YUV422_U0(*out_even) = u;
 
100
            YUV422_V0(*out_even) = v;
 
101
            YUV422_Y1(*out_even) = YUV411_Y00(in_even[1]);
 
102
 
 
103
            YUV422_Y0(*out_odd) = YUV411_Y00(in_odd[0]);
 
104
            YUV422_U0(*out_odd) = u;
 
105
            YUV422_V0(*out_odd) = v;
 
106
            YUV422_Y1(*out_odd) = YUV411_Y00(in_even[1]);
 
107
 
 
108
            in_even += 2;
 
109
            in_odd += 2;
 
110
            out_even++;
 
111
            out_odd++;
 
112
        }
 
113
        in_even += w4_3;
 
114
        in_odd += w4_3;
 
115
        out_even += w8;
 
116
        out_odd += w8;
 
117
    }
118
118
}