mmserv/thumbnailengine/ImaamiInc/DCDigitalZoom.h
changeset 0 71ca22bcf22a
equal deleted inserted replaced
-1:000000000000 0:71ca22bcf22a
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "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 *
       
    14 * Description:   
       
    15 *	CDCDCDigitalZoom 
       
    16 *		Scaling of image to display size & zooming.
       
    17 *		Includes support for different scaling and crop sizes with pan&scan.
       
    18 *		Pan can use previously computed scaled data when changing.
       
    19 *		Based on IMAAMI scaling algorithm.
       
    20 *
       
    21 */
       
    22 
       
    23 
       
    24 
       
    25 #ifndef __DIGITAL_ZOOM_H
       
    26 #define __DIGITAL_ZOOM_H
       
    27 
       
    28 #include <e32std.h> // for Fundamental Types
       
    29 #include <e32base.h> // for Fundamental Types
       
    30 #include <eikenv.h>
       
    31 #include "DCDefines.h"
       
    32 
       
    33 //Const tables for computation speed-up
       
    34 const TUint16 KDivTable[4 * 256] =
       
    35 {
       
    36 				  32768, 21845, 16384, 13107, 10923,  9362,  8192,  7282,
       
    37      6554,  5958,  5461,  5041,  4681,  4369,  4096,  3855,  3641,  3449,
       
    38      3277,  3121,  2979,  2849,  2731,  2621,  2521,  2427,  2341,  2260,
       
    39      2185,  2114,  2048,  1986,  1928,  1872,  1820,  1771,  1725,  1680,
       
    40      1638,  1598,  1560,  1524,  1489,  1456,  1425,  1394,  1365,  1337,
       
    41      1311,  1285,  1260,  1237,  1214,  1192,  1170,  1150,  1130,  1111,
       
    42      1092,  1074,  1057,  1040,  1024,  1008,   993,   978,   964,   950,
       
    43       936,   923,   910,   898,   886,   874,   862,   851,   840,   830,
       
    44       819,   809,   799,   790,   780,   771,   762,   753,   745,   736,
       
    45       728,   720,   712,   705,   697,   690,   683,   676,   669,   662,
       
    46       655,   649,   643,   636,   630,   624,   618,   612,   607,   601,
       
    47       596,   590,   585,   580,   575,   570,   565,   560,   555,   551,
       
    48       546,   542,   537,   533,   529,   524,   520,   516,   512,   508,
       
    49       504,   500,   496,   493,   489,   485,   482,   478,   475,   471,
       
    50       468,   465,   462,   458,   455,   452,   449,   446,   443,   440,
       
    51       437,   434,   431,   428,   426,   423,   420,   417,   415,   412,
       
    52       410,   407,   405,   402,   400,   397,   395,   392,   390,   388,
       
    53       386,   383,   381,   379,   377,   374,   372,   370,   368,   366,
       
    54       364,   362,   360,   358,   356,   354,   352,   350,   349,   347,
       
    55       345,   343,   341,   340,   338,   336,   334,   333,   331,   329,
       
    56       328,   326,   324,   323,   321,   320,   318,   317,   315,   314,
       
    57       312,   311,   309,   308,   306,   305,   303,   302,   301,   299,
       
    58       298,   297,   295,   294,   293,   291,   290,   289,   287,   286,
       
    59       285,   284,   282,   281,   280,   279,   278,   277,   275,   274,
       
    60       273,   272,   271,   270,   269,   267,   266,   265,   264,   263,
       
    61       262,   261,   260,   259,   258,   257,   256,   255,   254,   253,
       
    62       252,   251,   250,   249,   248,   247,   246,   245,   245,   244,
       
    63       243,   242,   241,   240,   239,   238,   237,   237,   236,   235,
       
    64       234,   233,   232,   232,   231,   230,   229,   228,   228,   227,
       
    65       226,   225,   224,   224,   223,   222,   221,   221,   220,   219,
       
    66       218,   218,   217,   216,   216,   215,   214,   213,   213,   212,
       
    67       211,   211,   210,   209,   209,   208,   207,   207,   206,   205,
       
    68       205,   204,   204,   203,   202,   202,   201,   200,   200,   199,
       
    69       199,   198,   197,   197,   196,   196,   195,   194,   194,   193,
       
    70       193,   192,   192,   191,   191,   190,   189,   189,   188,   188,
       
    71       187,   187,   186,   186,   185,   185,   184,   184,   183,   183,
       
    72       182,   182,   181,   181,   180,   180,   179,   179,   178,   178,
       
    73       177,   177,   176,   176,   175,   175,   174,   174,   173,   173,
       
    74       172,   172,   172,   171,   171,   170,   170,   169,   169,   168,
       
    75       168,   168,   167,   167,   166,   166,   165,   165,   165,   164,
       
    76       164,   163,   163,   163,   162,   162,   161,   161,   161,   160,
       
    77       160,   159,   159,   159,   158,   158,   158,   157,   157,   156,
       
    78       156,   156,   155,   155,   155,   154,   154,   153,   153,   153,
       
    79       152,   152,   152,   151,   151,   151,   150,   150,   150,   149,
       
    80       149,   149,   148,   148,   148,   147,   147,   147,   146,   146,
       
    81       146,   145,   145,   145,   144,   144,   144,   143,   143,   143,
       
    82       142,   142,   142,   142,   141,   141,   141,   140,   140,   140,
       
    83       139,   139,   139,   139,   138,   138,   138,   137,   137,   137,
       
    84       137,   136,   136,   136,   135,   135,   135,   135,   134,   134,
       
    85       134,   133,   133,   133,   133,   132,   132,   132,   132,   131,
       
    86       131,   131,   131,   130,   130,   130,   130,   129,   129,   129,
       
    87       129,   128,   128,   128,   128,   127,   127,   127,   127,   126,
       
    88       126,   126,   126,   125,   125,   125,   125,   124,   124,   124,
       
    89       124,   123,   123,   123,   123,   122,   122,   122,   122,   122,
       
    90       121,   121,   121,   121,   120,   120,   120,   120,   120,   119,
       
    91       119,   119,   119,   119,   118,   118,   118,   118,   117,   117,
       
    92       117,   117,   117,   116,   116,   116,   116,   116,   115,   115,
       
    93       115,   115,   115,   114,   114,   114,   114,   114,   113,   113,
       
    94       113,   113,   113,   112,   112,   112,   112,   112,   111,   111,
       
    95       111,   111,   111,   111,   110,   110,   110,   110,   110,   109,
       
    96       109,   109,   109,   109,   109,   108,   108,   108,   108,   108,
       
    97       107,   107,   107,   107,   107,   107,   106,   106,   106,   106,
       
    98       106,   106,   105,   105,   105,   105,   105,   105,   104,   104,
       
    99       104,   104,   104,   104,   103,   103,   103,   103,   103,   103,
       
   100       102,   102,   102,   102,   102,   102,   101,   101,   101,   101,
       
   101       101,   101,   101,   100,   100,   100,   100,   100,   100,    99,
       
   102        99,    99,    99,    99,    99,    99,    98,    98,    98,    98,
       
   103        98,    98,    98,    97,    97,    97,    97,    97,    97,    97,
       
   104        96,    96,    96,    96,    96,    96,    96,    95,    95,    95,
       
   105        95,    95,    95,    95,    94,    94,    94,    94,    94,    94,
       
   106        94,    93,    93,    93,    93,    93,    93,    93,    93,    92,
       
   107        92,    92,    92,    92,    92,    92,    92,    91,    91,    91,
       
   108        91,    91,    91,    91,    91,    90,    90,    90,    90,    90,
       
   109        90,    90,    90,    89,    89,    89,    89,    89,    89,    89,
       
   110        89,    88,    88,    88,    88,    88,    88,    88,    88,    87,
       
   111        87,    87,    87,    87,    87,    87,    87,    87,    86,    86,
       
   112        86,    86,    86,    86,    86,    86,    86,    85,    85,    85,
       
   113        85,    85,    85,    85,    85,    85,    84,    84,    84,    84,
       
   114        84,    84,    84,    84,    84,    83,    83,    83,    83,    83,
       
   115        83,    83,    83,    83,    83,    82,    82,    82,    82,    82,
       
   116        82,    82,    82,    82,    82,    81,    81,    81,    81,    81,
       
   117        81,    81,    81,    81,    81,    80,    80,    80,    80,    80,
       
   118        80,    80,    80,    80,    80,    79,    79,    79,    79,    79,
       
   119        79,    79,    79,    79,    79,    78,    78,    78,    78,    78,
       
   120        78,    78,    78,    78,    78,    78,    77,    77,    77,    77,
       
   121        77,    77,    77,    77,    77,    77,    77,    76,    76,    76,
       
   122        76,    76,    76,    76,    76,    76,    76,    76,    76,    75,
       
   123        75,    75,    75,    75,    75,    75,    75,    75,    75,    75,
       
   124        74,    74,    74,    74,    74,    74,    74,    74,    74,    74,
       
   125        74,    74,    73,    73,    73,    73,    73,    73,    73,    73,
       
   126        73,    73,    73,    73,    72,    72,    72,    72,    72,    72,
       
   127        72,    72,    72,    72,    72,    72,    72,    71,    71,    71,
       
   128        71,    71,    71,    71,    71,    71,    71,    71,    71,    71,
       
   129        70,    70,    70,    70,    70,    70,    70,    70,    70,    70,
       
   130        70,    70,    70,    69,    69,    69,    69,    69,    69,    69,
       
   131        69,    69,    69,    69,    69,    69,    69,    68,    68,    68,
       
   132        68,    68,    68,    68,    68,    68,    68,    68,    68,    68,
       
   133        68,    67,    67,    67,    67,    67,    67,    67,    67,    67,
       
   134        67,    67,    67,    67,    67,    67,    66,    66,    66,    66,
       
   135        66,    66,    66,    66,    66,    66,    66,    66,    66,    66,
       
   136        66,    65,    65,    65,    65,    65,    65,    65,    65,    65,
       
   137        65,    65,    65,    65,    65,    65,    65,    64,    64,    64,
       
   138        64,    64,    64,    64,    64,    64
       
   139 };
       
   140 
       
   141 
       
   142 
       
   143 
       
   144 // Class definition
       
   145 class CDCDigitalZoom : public CBase
       
   146 {
       
   147 public:
       
   148 	
       
   149 	// Struct definition
       
   150 	struct DCDigitalZoomParams
       
   151 	{
       
   152 		TInt sizeX;		//Output size
       
   153 		TInt sizeY;
       
   154 		TReal scaleX;	//Scaling factors
       
   155 		TReal scaleY;
       
   156 		TInt allShiftX;	//Pan location
       
   157 		TInt allShiftY;
       
   158 		TInt newShiftX;	//Change in pan (used for speed-up)
       
   159 		TInt newShiftY;	//only one value at time can be >0
       
   160 	};
       
   161 	
       
   162 	//Standard class functions
       
   163 	CDCDigitalZoom();
       
   164 	void ConstructL();	
       
   165 	static CDCDigitalZoom* NewL();
       
   166 	static CDCDigitalZoom* NewLC();
       
   167 	~CDCDigitalZoom();
       
   168 
       
   169 	// Process original image and store output image (main function)
       
   170 	void ProcessL(const CFbsBitmap* aOriPtr, CFbsBitmap* aOutPtr);
       
   171 
       
   172 	//Set processing parameters
       
   173 	void SetParameters(DCDigitalZoomParams* params);
       
   174 	
       
   175 	//Get current processing parameters
       
   176 	void GetParameters(DCDigitalZoomParams* params);
       
   177 	
       
   178 protected:
       
   179 
       
   180 	//Parameters
       
   181 	DCDigitalZoomParams iParams;
       
   182 
       
   183 private:
       
   184 
       
   185 	//Do actual resizing	
       
   186 	void DecimateL(const CFbsBitmap* aOriPtr, CFbsBitmap* aOutPtr,
       
   187 						   TInt aOutSizeX, TInt aOutSizeY,
       
   188 						   TInt aOriSizeX, TInt aOriSizeY,
       
   189 						   TReal aZoomX, TReal aZoomY,
       
   190 						   TInt allShiftX, TInt allShiftY,
       
   191 						   TInt newShiftX, TInt newShiftY);
       
   192 };
       
   193 #endif // ifndef __DIGITAL_ZOOM_H
       
   194 //----IMAAMI----