imagingmodules/jp2kcodec/Inc/JP2KUtils.h
changeset 0 469c91dae73b
child 4 3993b8f65362
equal deleted inserted replaced
-1:000000000000 0:469c91dae73b
       
     1 /*
       
     2 * Copyright (c) 2003, 2004 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:  TJ2kUtils class used to provide common public static
       
    15 *                functions used by all classes in JP2KCodec.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef __JP2KUTILS_H__
       
    21 #define __JP2KUTILS_H__
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 
       
    26 // CONSTANTS
       
    27 const TInt KImplementationPrecision = 32;
       
    28 
       
    29 // MACROS
       
    30 
       
    31 // DATA TYPES
       
    32 
       
    33 typedef TInt32 TPrecInt;
       
    34 
       
    35 struct TDiv
       
    36     {
       
    37     TInt quot; // Quotient
       
    38     TInt rem;  // Remainder
       
    39     };
       
    40 
       
    41 // FUNCTION PROTOTYPES
       
    42 
       
    43 // FORWARD DECLARATIONS
       
    44 
       
    45 // CLASS DECLARATION
       
    46 
       
    47 /**
       
    48 *  TJ2kUtils class used to provide common public static
       
    49 *  methods used by all classes
       
    50 *
       
    51 *  JP2KCodec.dll
       
    52 *  @since 2.6
       
    53 */
       
    54 class TJ2kUtils
       
    55     {
       
    56     public:  // Constructors and destructor
       
    57         
       
    58     public: // New functions
       
    59         
       
    60         /**
       
    61         * Get the ceiling between two integers
       
    62         * @since 2.6
       
    63         * @param aL: first integer to compute.
       
    64         * @param aR: second integer to compute.
       
    65         * @return TInt32: the ceiling between two integers aL and aR.
       
    66         */
       
    67         static TInt32 Ceil( TInt32 aL, TInt32 aR );
       
    68 
       
    69         /**
       
    70         * Get the floor between two integers
       
    71         * @since 2.6
       
    72         * @param aL: first integer to compute.
       
    73         * @param aR: second integer to compute.
       
    74         * @return TInt32: the floor between two integers aL and aR.
       
    75         */
       
    76         static TInt32 Floor( TInt32 aL, TInt32 aR );
       
    77 
       
    78         /**
       
    79         * Get the quotient and remainder
       
    80         * @since 2.6
       
    81         * @param aNum: first integer to compute.
       
    82         * @param aDenom: divisor integer.
       
    83         * @return TDiv: the structure contains the quotient and remainder.
       
    84         */
       
    85         static TDiv Div( TInt aNum, TInt aDenom );
       
    86 
       
    87         /**
       
    88         * Get the log2 value of an integer
       
    89         * @since 2.6
       
    90         * @param aI: an integer to compute.
       
    91         * @return TInt32: the log2 value of the integer aI.
       
    92         */
       
    93         static TInt32 Log2( TUint32 aI );
       
    94 
       
    95         /**
       
    96         * Allocate 2-D array
       
    97         * @since 2.6
       
    98         * @param aRowSize: row size of the 2-D array.
       
    99         * @param aColSize: column size of the 2-D array.
       
   100         * @return TPrecInt**: a pointer of pointer to TPrecInt.
       
   101         */
       
   102         static TPrecInt** Alloc2DArrayL( TInt aRowSize, TInt aColSize );
       
   103 
       
   104         /**
       
   105         * Free 2-D array
       
   106         * @since 2.6
       
   107         * @param aPtr: a pointer of pointer to TPrecInt to be freed.
       
   108         */
       
   109         static void Free2DArray( TPrecInt **aPtr );
       
   110 
       
   111         /**
       
   112         * Wrapper to free 2-D array when put into TCleanupItem
       
   113         * @since 2.6
       
   114         * @param aPtr: a pointer of pointer to TAny to be freed.
       
   115         */
       
   116         static void Free2DArray( TAny *aPtr );
       
   117 
       
   118     public: // Functions from base classes
       
   119        
       
   120     protected:  // New functions        
       
   121 
       
   122     protected:  // Functions from base classes
       
   123 
       
   124     private:
       
   125 
       
   126     public:     // Data
       
   127     
       
   128     protected:  // Data
       
   129 
       
   130     private:    // Data
       
   131 
       
   132     public:     // Friend classes
       
   133  
       
   134     protected:  // Friend classes
       
   135 
       
   136     private:    // Friend classes
       
   137 
       
   138     };
       
   139 
       
   140 #endif // __JP2KUTILS_H__