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