imagingmodules/jp2kcodec/Inc/JP2KImageUtils.inl
changeset 0 469c91dae73b
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:  Basic utilities to handle conversion and object safe deletion.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __JP2KIMAGEUTILS_INL__
       
    20 #define __JP2KIMAGEUTILS_INL__
       
    21 
       
    22 // ============================ MEMBER FUNCTIONS ===============================
       
    23 
       
    24 // -----------------------------------------------------------------------------
       
    25 // PtrReadUtil::ReadBigEndianUint16
       
    26 // Reads big endian value from given buffer.
       
    27 // (other items were commented in a header).
       
    28 // -----------------------------------------------------------------------------
       
    29 //
       
    30 inline TUint16 PtrReadUtil::ReadBigEndianUint16( const TUint8* aPtr )
       
    31     {
       
    32     return TUint16( ( aPtr[0] << 8 ) | aPtr[1] );
       
    33     }
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // PtrReadUtil::ReadBigEndianUint32
       
    37 // Reads big endian value from given buffer.
       
    38 // (other items were commented in a header).
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 inline TUint32 PtrReadUtil::ReadBigEndianUint32( const TUint8* aPtr )
       
    42     {
       
    43     return TUint32( ( aPtr[0] << 24 ) | ( aPtr[1] << 16 ) | ( aPtr[2] << 8 ) | aPtr[3] );
       
    44     }
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // PtrReadUtil::ReadBigEndianUint16Inc
       
    48 // Reads big endian value from given buffer and increments pointer.
       
    49 // (other items were commented in a header).
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 inline TUint16 PtrReadUtil::ReadBigEndianUint16Inc( const TUint8*& aPtr )
       
    53     {
       
    54     TUint16 result = ReadBigEndianUint16( aPtr );
       
    55     aPtr += 2;
       
    56     return result;
       
    57     }
       
    58 
       
    59 // -----------------------------------------------------------------------------
       
    60 // PtrReadUtil::ReadBigEndianUint32Inc
       
    61 // Reads big endian value from given buffer and increments pointer.
       
    62 // (other items were commented in a header).
       
    63 // -----------------------------------------------------------------------------
       
    64 //
       
    65 inline TUint32 PtrReadUtil::ReadBigEndianUint32Inc( const TUint8*& aPtr )
       
    66     {
       
    67     TUint32 result = ReadBigEndianUint32( aPtr );
       
    68     aPtr += 4;
       
    69     return result;
       
    70     }
       
    71 
       
    72 #endif