1 /* |
|
2 * Copyright (c) 2010 Ixonos Plc. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - Initial contribution |
|
11 * |
|
12 * Contributors: |
|
13 * Ixonos Plc |
|
14 * |
|
15 * Description: |
|
16 * YUV to EColor64K colorspace converter concrete classes. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef __YUV2RGB16_H__ |
|
22 #define __YUV2RGB16_H__ |
|
23 |
|
24 // INCLUDES |
|
25 |
|
26 #ifndef __YUVCONVERTER_H__ |
|
27 #include "yuvconverter.h" |
|
28 #endif |
|
29 |
|
30 // CLASS DEFINITIONS |
|
31 |
|
32 class CYuv2Rgb16 : public CYuvConverter |
|
33 { |
|
34 public: // CYuvConverter methods |
|
35 // Constructors & destructor |
|
36 CYuv2Rgb16(); |
|
37 ~CYuv2Rgb16(); |
|
38 void ConstructL(TUint aWidth, TUint aHeight, TUint aMaxWidth, TUint aMaxHeight); |
|
39 |
|
40 void Convert(const TUint8 *aYBuf, const TUint8 *aUBuf, |
|
41 const TUint8 *aVBuf, |
|
42 TUint aBufWidth, TUint aBufHeight, |
|
43 TUint8 *aTarget, TUint aTargetScanlineLength); |
|
44 |
|
45 void SetGamma(TInt /*aGamma*/) {}; |
|
46 |
|
47 protected: // Data |
|
48 |
|
49 TUint iWidth, iHeight; |
|
50 |
|
51 }; |
|
52 |
|
53 |
|
54 // The fixed point constants for YUV -> RGB conversion |
|
55 const TInt KYMult = 296; |
|
56 const TInt KCrToR = 408; |
|
57 const TInt KCbToG = 96; |
|
58 const TInt KCrToG = 204; |
|
59 const TInt KCbToB = 520; |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // UvToRDiff |
|
63 // Calculate the red color difference from Cr by using fixed point values. |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 inline TInt UvToRDiff( |
|
67 TInt aCr, |
|
68 TInt /*aCb*/) |
|
69 { |
|
70 return (KCrToR * aCr) / 256; |
|
71 } |
|
72 |
|
73 // ----------------------------------------------------------------------------- |
|
74 // UvToGDiff |
|
75 // Calculate the green color difference from Cr and Cb components |
|
76 // by using fixed point values. |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 inline TInt UvToGDiff( |
|
80 TInt aCr, |
|
81 TInt aCb) |
|
82 { |
|
83 return (KCbToG * aCb + KCrToG * aCr) / 256; |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // UvToBDiff |
|
88 // Calculate the blue color difference from Cb by using fixed point values. |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 inline TInt UvToBDiff( |
|
92 TInt /*aCr*/, |
|
93 TInt aCb) |
|
94 { |
|
95 return (KCbToB * aCb) / 256; |
|
96 } |
|
97 |
|
98 |
|
99 #endif |
|