diff -r 0dfaca43d90e -r 606eafc6d6a8 baseport/syborg/webcamera/webcamer_convert.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/baseport/syborg/webcamera/webcamer_convert.h Mon Oct 18 19:39:25 2010 +0900 @@ -0,0 +1,143 @@ +/* +* Copyright (c) 2010 ISB. +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* ISB - Initial contribution +* +* Contributors: +* +* Description: +* +*/ + +#ifndef WEBCAMERACONVERT_H__ +#define WEBCAMERACONVERT_H__ + +#include +#include +#ifndef WEBCAMERA_UVC_H_ +#include "webcamera_uvc.h" +#endif + +const TUint KWebcameraNeutralGrayValue = 220; +const TUint KWebcameraColorGradation = 256; // true color. +const TUint KWebcameraBitMask = 0x000000ff; +const TUint KWebcameraBitMask8 = 0x0000ff00; +const TUint KWebcameraBitMask16 = 0x00ff0000; + +/** +Perform a Convert function Base. +*/ +class DWebCameraConvertBase : public DBase + { +public: + /** + Constructor. + */ + DWebCameraConvertBase(TWebcameraUVC* aUvcFormat); + + /** + Destructor. + */ + ~DWebCameraConvertBase(); +public: //virtual function. + /** + Convert FrameData to Bitmap. + + @param aInBuf [in] FrameData before conversion. + aOutBuf [out] BimapData after conversion. + @return KErrNotSupported. Implement in sub-class, return unsupport in base-class. + */ + virtual TInt ConvertData(TUint8* aInBuf, TUint8* aOutBuf); + +protected: + TWebcameraUVC* iUvcFormat; + }; + +/** +Perform a Convert function (Yuv -> Bitmap). +*/ +class DWebCameraConvertYuv : public DWebCameraConvertBase + { +public: + /** + Create object. + @return Pointer of object. + */ + static DWebCameraConvertYuv* NewL(); + + /** + Constructor. + */ + DWebCameraConvertYuv(TWebcameraUVC* aUvcFormat); + + /** + Destructor. + */ + ~DWebCameraConvertYuv(); + +public: //from DWebCameraConvertBase + /** + Convert FrameData to Bitmap(YUV->Bitmap). + + @param aInBuf [in] FrameData before conversion. + aOutBuf [out BitmapData after conversion. + @return KErrNone. + */ + TInt ConvertData(TUint8* aInBuf, TUint8* aOutBuf); +private: + /** + Secondary constructor. + */ + void ConstructL(); + + /** + Convert YUV to RGB. + + @param aY [in] Signal of brightness. + aU [in] Signal of colour difference(Cb). + aV [in] Signal of colour difference(cr). + @return Pixel. + */ + TInt ConvertYuvToBitmap(TInt aY, TInt aU, TInt aV); + }; + +/** +Convert function +*/ +class DWebCameraConvert : public DBase + { +public: + /** + Constructor. + */ + DWebCameraConvert(TWebcameraUVC* aUvcFormat); + + /** + Destructor. + */ + ~DWebCameraConvert(); + + /** + Decide video format, by video format from UVC class. + + @param aInBuf [in] Data to convert. + aOutBuf [out] BitmapData after conversion. + aVideoData [in] Format data of Video. + @return KErrNone + */ + TInt ConvertData(TUint8* aInBuf, TUint8* aOutBuf); + +private: + /** + Store the instance. + */ + DWebCameraConvertBase* iConvertObject; + }; + +#endif // ECAMWEBCAMERACONVERT_H