~ubuntu-branches/ubuntu/gutsy/amsn/gutsy

« back to all changes in this revision

Viewing changes to utils/linux/capture/libng/color_unused.c

  • Committer: Bazaar Package Importer
  • Author(s): Theodore Karkoulis
  • Date: 2006-01-04 15:26:02 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060104152602-ipe1yg00rl3nlklv
Tags: 0.95-1
New Upstream Release (closes: #345052, #278575).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ------------------------------------------------------------------- */
 
2
/* YUV conversions                                                     */
 
3
 
 
4
int
 
5
packed422_to_planar422(unsigned char *d, unsigned char *s, int p)
 
6
{
 
7
    int i;
 
8
    unsigned char *y,*u,*v;
 
9
 
 
10
    i = p/2;
 
11
    y = d;
 
12
    u = y + p;
 
13
    v = u + p / 2;
 
14
    
 
15
    while (--i) {
 
16
        *(y++) = *(s++);
 
17
        *(u++) = *(s++);
 
18
        *(y++) = *(s++);
 
19
        *(v++) = *(s++);
 
20
    }
 
21
    return p*2;
 
22
}
 
23
 
 
24
/* y only, no chroma */
 
25
int
 
26
packed422_to_planar420(unsigned char *d, unsigned char *s, int p)
 
27
{
 
28
    int i;
 
29
    unsigned char *y;
 
30
 
 
31
    i = p/2;
 
32
    y = d;
 
33
    
 
34
    while (--i) {
 
35
        *(y++) = *(s++);
 
36
        s++;
 
37
        *(y++) = *(s++);
 
38
        s++;
 
39
    }
 
40
    return p*3/2;
 
41
}
 
42
 
 
43
#if 0
 
44
void
 
45
x_packed422_to_planar420(unsigned char *d, unsigned char *s, int w, int h)
 
46
{
 
47
    int  a,b;
 
48
    unsigned char *y,*u,*v;
 
49
 
 
50
    y = d;
 
51
    u = y + w * h;
 
52
    v = u + w * h / 4;
 
53
 
 
54
    for (a = h; a > 0; a -= 2) {
 
55
        for (b = w; b > 0; b -= 2) {
 
56
            *(y++) = *(s++);
 
57
            *(u++) = *(s++);
 
58
            *(y++) = *(s++);
 
59
            *(v++) = *(s++);
 
60
        }
 
61
        for (b = w; b > 0; b -= 2) {
 
62
            *(y++) = *(s++);
 
63
            s++;
 
64
            *(y++) = *(s++);
 
65
            s++;
 
66
        }
 
67
    }
 
68
}
 
69
#endif