|
1 /* |
|
2 * Copyright (c) 2010 ISB. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "Symbian Foundation License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * ISB - Initial contribution |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef WEBCAMERACONVERT_H__ |
|
19 #define WEBCAMERACONVERT_H__ |
|
20 |
|
21 #include <e32def.h> |
|
22 #include <comm.h> |
|
23 #ifndef WEBCAMERA_UVC_H_ |
|
24 #include "webcamera_uvc.h" |
|
25 #endif |
|
26 |
|
27 const TUint KWebcameraNeutralGrayValue = 220; |
|
28 const TUint KWebcameraColorGradation = 256; // true color. |
|
29 const TUint KWebcameraBitMask = 0x000000ff; |
|
30 const TUint KWebcameraBitMask8 = 0x0000ff00; |
|
31 const TUint KWebcameraBitMask16 = 0x00ff0000; |
|
32 |
|
33 /** |
|
34 Perform a Convert function Base. |
|
35 */ |
|
36 class DWebCameraConvertBase : public DBase |
|
37 { |
|
38 public: |
|
39 /** |
|
40 Constructor. |
|
41 */ |
|
42 DWebCameraConvertBase(TWebcameraUVC* aUvcFormat); |
|
43 |
|
44 /** |
|
45 Destructor. |
|
46 */ |
|
47 ~DWebCameraConvertBase(); |
|
48 public: //virtual function. |
|
49 /** |
|
50 Convert FrameData to Bitmap. |
|
51 |
|
52 @param aInBuf [in] FrameData before conversion. |
|
53 aOutBuf [out] BimapData after conversion. |
|
54 @return KErrNotSupported. Implement in sub-class, return unsupport in base-class. |
|
55 */ |
|
56 virtual TInt ConvertData(TUint8* aInBuf, TUint8* aOutBuf); |
|
57 |
|
58 protected: |
|
59 TWebcameraUVC* iUvcFormat; |
|
60 }; |
|
61 |
|
62 /** |
|
63 Perform a Convert function (Yuv -> Bitmap). |
|
64 */ |
|
65 class DWebCameraConvertYuv : public DWebCameraConvertBase |
|
66 { |
|
67 public: |
|
68 /** |
|
69 Create object. |
|
70 @return Pointer of object. |
|
71 */ |
|
72 static DWebCameraConvertYuv* NewL(); |
|
73 |
|
74 /** |
|
75 Constructor. |
|
76 */ |
|
77 DWebCameraConvertYuv(TWebcameraUVC* aUvcFormat); |
|
78 |
|
79 /** |
|
80 Destructor. |
|
81 */ |
|
82 ~DWebCameraConvertYuv(); |
|
83 |
|
84 public: //from DWebCameraConvertBase |
|
85 /** |
|
86 Convert FrameData to Bitmap(YUV->Bitmap). |
|
87 |
|
88 @param aInBuf [in] FrameData before conversion. |
|
89 aOutBuf [out BitmapData after conversion. |
|
90 @return KErrNone. |
|
91 */ |
|
92 TInt ConvertData(TUint8* aInBuf, TUint8* aOutBuf); |
|
93 private: |
|
94 /** |
|
95 Secondary constructor. |
|
96 */ |
|
97 void ConstructL(); |
|
98 |
|
99 /** |
|
100 Convert YUV to RGB. |
|
101 |
|
102 @param aY [in] Signal of brightness. |
|
103 aU [in] Signal of colour difference(Cb). |
|
104 aV [in] Signal of colour difference(cr). |
|
105 @return Pixel. |
|
106 */ |
|
107 TInt ConvertYuvToBitmap(TInt aY, TInt aU, TInt aV); |
|
108 }; |
|
109 |
|
110 /** |
|
111 Convert function |
|
112 */ |
|
113 class DWebCameraConvert : public DBase |
|
114 { |
|
115 public: |
|
116 /** |
|
117 Constructor. |
|
118 */ |
|
119 DWebCameraConvert(TWebcameraUVC* aUvcFormat); |
|
120 |
|
121 /** |
|
122 Destructor. |
|
123 */ |
|
124 ~DWebCameraConvert(); |
|
125 |
|
126 /** |
|
127 Decide video format, by video format from UVC class. |
|
128 |
|
129 @param aInBuf [in] Data to convert. |
|
130 aOutBuf [out] BitmapData after conversion. |
|
131 aVideoData [in] Format data of Video. |
|
132 @return KErrNone |
|
133 */ |
|
134 TInt ConvertData(TUint8* aInBuf, TUint8* aOutBuf); |
|
135 |
|
136 private: |
|
137 /** |
|
138 Store the instance. |
|
139 */ |
|
140 DWebCameraConvertBase* iConvertObject; |
|
141 }; |
|
142 |
|
143 #endif // ECAMWEBCAMERACONVERT_H |