~ubuntu-branches/ubuntu/trusty/libavg/trusty-proposed

« back to all changes in this revision

Viewing changes to src/graphics/Pixel32.cpp

  • Committer: Package Import Robot
  • Author(s): OXullo Intersecans
  • Date: 2011-12-06 22:44:56 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20111206224456-qc7250z3ya1vi8s9
Tags: 1.7.0-0ubuntu1
* New upstream release (LP: #899183)
* Remove patches 0002-libav-0.7.patch, 0003-fglrx-segfault-on-startup.patch
  now merged to upstream
* Remove unnecessary .la files
* Update debian/watch file
* Fix debian/copyright dep-5 compliancy
* Update standards to version 3.9.2
* Add man pages for avg_checktouch, avg_checkvsync, avg_showsvg
* Minor debian/rules enhancement
* Add librsvg2-dev, libgdk-pixbuf2.0-dev to Build-Depends
* Proper transition to dh_python2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//
2
2
//  libavg - Media Playback Engine. 
3
 
//  Copyright (C) 2003-2008 Ulrich von Zadow
 
3
//  Copyright (C) 2003-2011 Ulrich von Zadow
4
4
//
5
5
//  This library is free software; you can redistribute it and/or
6
6
//  modify it under the terms of the GNU Lesser General Public
84
84
    return Pixel32(r,g,b);
85
85
}
86
86
 
 
87
void YUVtoBGR32Pixel(Pixel32* pDest, int y, int u, int v)
 
88
{
 
89
    // u = Cb, v = Cr
 
90
    int u1 = u - 128;
 
91
    int v1 = v - 128;
 
92
    int tempy = 298*(y-16);
 
93
    int b = (tempy + 516 * u1           ) >> 8;
 
94
    int g = (tempy - 100 * u1 - 208 * v1) >> 8;
 
95
    int r = (tempy            + 409 * v1) >> 8;
 
96
 
 
97
    if (b<0) b = 0;
 
98
    if (b>255) b= 255;
 
99
    if (g<0) g = 0;
 
100
    if (g>255) g= 255;
 
101
    if (r<0) r = 0;
 
102
    if (r>255) r= 255;
 
103
    pDest->set(b,g,r,255);
 
104
}
 
105
 
 
106
void YUVJtoBGR32Pixel(Pixel32* pDest, int y, int u, int v)
 
107
{
 
108
    // u = Cb, v = Cr
 
109
    int u1 = u - 128;
 
110
    int v1 = v - 128;
 
111
    int tempy = 256*y;
 
112
    int b = (tempy + 452 * u1           ) >> 8;
 
113
    int g = (tempy -  88 * u1 - 182 * v1) >> 8;
 
114
    int r = (tempy            + 358 * v1) >> 8;
 
115
 
 
116
    if (b<0) b = 0;
 
117
    if (b>255) b= 255;
 
118
    if (g<0) g = 0;
 
119
    if (g>255) g= 255;
 
120
    if (r<0) r = 0;
 
121
    if (r>255) r= 255;
 
122
    pDest->set(b,g,r,255);
 
123
}
 
124
 
87
125
std::ostream& operator <<(std::ostream& os, const Pixel32& pix)
88
126
{
89
127
    os << pix.getColorString();