videoeditorengine/vedengine/GenManip/inc/DCIetd.h
branchRCL_3
changeset 3 e0b5df5c0969
parent 0 951a5db380a0
child 7 4c409de21d23
equal deleted inserted replaced
0:951a5db380a0 3:e0b5df5c0969
     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 *
       
    17 */
       
    18 
       
    19 
       
    20 //----IMAAMI----
       
    21 //*************************************************************************
       
    22 //CDCIETD.h
       
    23 //
       
    24 //Version 2.00
       
    25 //
       
    26 //Contains:
       
    27 //	CDCIETD 
       
    28 //		Display specific color contrast enhancement, 
       
    29 //		Image Enhancement for Transflective Displays version 2,
       
    30 //		IETD 2.
       
    31 //
       
    32 // The class implements the following image enhancements algorithms:
       
    33 //	    - Histogram guided contrast stretch
       
    34 //	    - Color saturation increase
       
    35 //
       
    36 // Usage:
       
    37 //  	- First an instance of this class is created by factory functions NewL() or NewLC.
       
    38 //		- All settings and configurations can be done by calling function SetParams().
       
    39 //		  Current parameters can be checked by calling function GetParams().
       
    40 //		- Then the The Analyze() function is called with CFbsBitmap as an argumet.
       
    41 //		  This function have to be called at least once before ProcessL().  
       
    42 //		- Then the The ProcessL() function is called with CFbsBitmap as an argumet.
       
    43 //		  The bitmap is handled in place so this function modifies the given bitmap.
       
    44 //
       
    45 //History:
       
    46 //	23.10.2003 version 2.00 created using existing IMAAMI IETD	
       
    47 //*************************************************************************
       
    48 
       
    49 #ifndef  __DCIetd_H__
       
    50 #define  __DCIetd_H__
       
    51 
       
    52 //  INCLUDES
       
    53 
       
    54 #ifndef   __E32STD_H__
       
    55 #include  <e32std.h>   // for Fundamental Types
       
    56 #endif // __E32STD_H__
       
    57 
       
    58 #ifndef   __E32BASE_H__
       
    59 #include  <e32base.h>  // for CBase
       
    60 #endif // __E32BASE_H__
       
    61 
       
    62 //Default parameters
       
    63 #include "DCInit.h"
       
    64 
       
    65 
       
    66 //-------------------
       
    67 //  CLASS DEFINITIONS 
       
    68 // CDCIetd - The one and ony class to contain all required methods
       
    69 // to implement DCIetd functionality.
       
    70 class CDCIetd : public CBase
       
    71     {
       
    72     public:     
       
    73 
       
    74 		//Parameter struct
       
    75 		struct DCIetdParameters
       
    76 		{
       
    77 			TUint8 aWhitePixels; 	//Percentage of pixels stretched to maximum value
       
    78 			TUint8 aBlackPixels;	//Percentage of pixels stretched to minimum value
       
    79 			TUint8 aStretchLimit;	//Narrowest histogram to be stretched to full range
       
    80 			TUint8 aSaturationGain;	//Saturation increase gain
       
    81 			TUint8 aBitLimit;		//Minimum number of color values for full gain		
       
    82 			TUint8 aWBC;			//White balance correction limit
       
    83 			TUint8 aDBC;			//Dark balance correction limit
       
    84 		};
       
    85 
       
    86         CDCIetd();				// Constructor
       
    87         static CDCIetd* NewL();	// Factory function NewL
       
    88         static CDCIetd* NewLC();// Factory function NewLC
       
    89         ~CDCIetd();				// Destructor
       
    90         void ConstructL();		// Second Phase contructor (may leave)
       
    91         
       
    92 		// Analyze image referenced by aBPtr
       
    93 		void Analyze(CFbsBitmap& aBPtr);
       
    94 
       
    95 		// Process and store image referenced by aBPtr
       
    96 		void ProcessL(CFbsBitmap& aBPtr);
       
    97 
       
    98 		// Parameter exchange
       
    99 		void SetParams(DCIetdParameters* parameters);
       
   100 		void GetParams(DCIetdParameters* parameters);
       
   101         
       
   102     private:
       
   103 
       
   104 		void GatherHistograms(const CFbsBitmap& aBPtr); // Construct the R, G, and B Histograms
       
   105         void MakeMappings();                            // Calculate the mapping LUTs
       
   106 
       
   107         // Limit integer value to byte [0,255]
       
   108         static inline TUint8 Limit255(TInt i) {return (TUint8)(i<0?0:(i>255?255:i));}
       
   109 
       
   110         TUint    iHistogram[3][256];  // Histogram data
       
   111         TUint8   iMap[3][256];        // Color component mapping funtions
       
   112         HBufC8*  iScanLineBuffer;     // Scan line buffer
       
   113 
       
   114         TUint8 iReducedStretchLimit[3]; //Stretch limits for each component
       
   115 
       
   116 		DCIetdParameters iParameters; //Parameters
       
   117     };
       
   118 
       
   119 #endif // __DCIetd_H__
       
   120             
       
   121 // End of File
       
   122 //----IMAAMI----