imagingmodules/jp2kcodec/Inc/JP2KPacket.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:  JP2KPacket class used to collect packet related
       
    15 *                information such as tag tree and list of codeblocks.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef __JP2KPACKET_INL__
       
    21 #define __JP2KPACKET_INL__
       
    22 
       
    23 // ============================ MEMBER FUNCTIONS ===============================
       
    24 
       
    25 // -----------------------------------------------------------------------------
       
    26 // CJ2kPacket::LastCodeBlockProcessed
       
    27 // Get the last codeblock processed
       
    28 // (other items were commented in a header).
       
    29 // -----------------------------------------------------------------------------
       
    30 //
       
    31 inline TUint16 CJ2kPacket::LastCodeBlockProcessed() const
       
    32     {
       
    33     return iLastCodeBlock;
       
    34     }
       
    35 
       
    36 // -----------------------------------------------------------------------------
       
    37 // CJ2kPacket::SetLastCodeBlockProcessed
       
    38 // Set the last codeblock processed
       
    39 // (other items were commented in a header).
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 inline void CJ2kPacket::SetLastCodeBlockProcessed( TUint16 aLastCodeBlock )
       
    43     {
       
    44     iLastCodeBlock = aLastCodeBlock;
       
    45     }
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // CJ2kPacket::NumOfBlocks
       
    49 // Get number of blocks
       
    50 // (other items were commented in a header).
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 inline TUint16 CJ2kPacket::NumOfBlocks() const
       
    54     {
       
    55     return (TUint16)( iCodeBlockSize.iWidth * iCodeBlockSize.iHeight );
       
    56     }
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // CJ2kPacket::NumOfBlocksX
       
    60 // Get number of blocks in horizontal direction
       
    61 // (other items were commented in a header).
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 inline TUint16 CJ2kPacket::NumOfBlocksX() const
       
    65     {
       
    66     return (TUint16)iCodeBlockSize.iWidth;
       
    67     }
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 // CJ2kPacket::NumOfBlocksY
       
    71 // Get number of blocks in vertical direction
       
    72 // (other items were commented in a header).
       
    73 // -----------------------------------------------------------------------------
       
    74 //
       
    75 inline TUint16 CJ2kPacket::NumOfBlocksY() const
       
    76     {
       
    77     return (TUint16)iCodeBlockSize.iHeight;
       
    78     }
       
    79 
       
    80 
       
    81 // -----------------------------------------------------------------------------
       
    82 // CJ2kPacket::CodeBlockAt
       
    83 // Get the codeblock at specific location
       
    84 // (other items were commented in a header).
       
    85 // -----------------------------------------------------------------------------
       
    86 //
       
    87 inline const CJ2kCodeBlock& CJ2kPacket::CodeBlockAt( TUint16 aIndex ) const
       
    88     {
       
    89     return *iCodeBlockList[aIndex];
       
    90     }
       
    91 
       
    92 // -----------------------------------------------------------------------------
       
    93 // CJ2kPacket::IsBodyIncomplete
       
    94 // Is packet body read underflow
       
    95 // (other items were commented in a header).
       
    96 // -----------------------------------------------------------------------------
       
    97 //
       
    98 inline TUint8 CJ2kPacket::IsBodyIncomplete() const
       
    99     {
       
   100     return (TUint8)( iReadControl & EReadBodyIncomplete );
       
   101     }
       
   102 
       
   103 // -----------------------------------------------------------------------------
       
   104 // CJ2kPacket::IncTagValue
       
   105 // Get the included tag tree value at specific level and width
       
   106 // (other items were commented in a header).
       
   107 // -----------------------------------------------------------------------------
       
   108 //
       
   109 inline TUint16 CJ2kPacket::IncTagValue( TUint16 aLevel, TUint16 aWidth ) const
       
   110     {
       
   111     return ( iIncTagTreeValue->Des() )[( iTagTreeInfo->Des() )[aLevel] + aWidth];
       
   112     }
       
   113 
       
   114 // -----------------------------------------------------------------------------
       
   115 // CJ2kPacket::IncTagState
       
   116 // Get the included tag tree state at specific level and width
       
   117 // (other items were commented in a header).
       
   118 // -----------------------------------------------------------------------------
       
   119 //
       
   120 inline TUint16 CJ2kPacket::IncTagState( TUint16 aLevel, TUint16 aWidth ) const
       
   121     {
       
   122     return ( iIncTagTreeState->Des() )[( iTagTreeInfo->Des() )[aLevel] + aWidth];
       
   123     }
       
   124 
       
   125 // -----------------------------------------------------------------------------
       
   126 // CJ2kPacket::MsbTagValue
       
   127 // Get the msb tag tree value at specific level and width
       
   128 // (other items were commented in a header).
       
   129 // -----------------------------------------------------------------------------
       
   130 //
       
   131 inline TUint16 CJ2kPacket::MsbTagValue( TUint16 aLevel, TUint16 aWidth ) const
       
   132     {
       
   133     return ( iMsbTagTreeValue->Des() )[( iTagTreeInfo->Des() )[aLevel] + aWidth];
       
   134     }
       
   135 
       
   136 // -----------------------------------------------------------------------------
       
   137 // CJ2kPacket::MsbTagState
       
   138 // Get the msb tag tree state at specific level and width
       
   139 // (other items were commented in a header).
       
   140 // -----------------------------------------------------------------------------
       
   141 //
       
   142 inline TUint16 CJ2kPacket::MsbTagState( TUint16 aLevel, TUint16 aWidth ) const
       
   143     {
       
   144     return ( iMsbTagTreeState->Des() )[( iTagTreeInfo->Des() )[aLevel] + aWidth];
       
   145     }
       
   146 
       
   147 // -----------------------------------------------------------------------------
       
   148 // CJ2kPacket::SetIncTagValue
       
   149 // Set the included tag tree value at specific level and width
       
   150 // (other items were commented in a header).
       
   151 // -----------------------------------------------------------------------------
       
   152 //
       
   153 inline void CJ2kPacket::SetIncTagValue( TUint16 aLevel, TUint16 aWidth, TUint16 aValue ) 
       
   154     {
       
   155     TPtr16 tmpPtr = ( iIncTagTreeValue->Des() );
       
   156     tmpPtr[( iTagTreeInfo->Des() )[aLevel] + aWidth] = aValue;
       
   157     }
       
   158 
       
   159 // -----------------------------------------------------------------------------
       
   160 // CJ2kPacket::SetIncTagState
       
   161 // Set the included tag tree state at specific level and width
       
   162 // (other items were commented in a header).
       
   163 // -----------------------------------------------------------------------------
       
   164 //
       
   165 inline void CJ2kPacket::SetIncTagState( TUint16 aLevel, TUint16 aWidth, TUint16 aState )
       
   166     {
       
   167     TPtr16 tmpPtr = ( iIncTagTreeState->Des() );
       
   168     tmpPtr[( iTagTreeInfo->Des() )[aLevel] + aWidth] = aState;
       
   169     }
       
   170 
       
   171 // -----------------------------------------------------------------------------
       
   172 // CJ2kPacket::IncrementIncTagState
       
   173 // Increment the included tag tree state at specific level and width
       
   174 // (other items were commented in a header).
       
   175 // -----------------------------------------------------------------------------
       
   176 //
       
   177 inline void CJ2kPacket::IncrementIncTagState( TUint16 aLevel, TUint16 aWidth )
       
   178     {
       
   179     TPtr16 tmpPtr = ( iIncTagTreeState->Des() );
       
   180     tmpPtr[( iTagTreeInfo->Des() )[aLevel] + aWidth]++;
       
   181     }
       
   182 
       
   183 // -----------------------------------------------------------------------------
       
   184 // CJ2kPacket::SetMsbTagValue
       
   185 // Set the msb tag tree value at specific level and width
       
   186 // (other items were commented in a header).
       
   187 // -----------------------------------------------------------------------------
       
   188 //
       
   189 inline void CJ2kPacket::SetMsbTagValue( TUint16 aLevel, TUint16 aWidth, TUint16 aValue ) 
       
   190     {
       
   191     TPtr16 tmpPtr = ( iMsbTagTreeValue->Des() );
       
   192     tmpPtr[( iTagTreeInfo->Des() )[aLevel] + aWidth] = aValue;
       
   193     }
       
   194 
       
   195 // -----------------------------------------------------------------------------
       
   196 // CJ2kPacket::SetMsbTagState
       
   197 // Set the msb tag tree state at specific level and width
       
   198 // (other items were commented in a header).
       
   199 // -----------------------------------------------------------------------------
       
   200 //
       
   201 inline void CJ2kPacket::SetMsbTagState( TUint16 aLevel, TUint16 aWidth, TUint16 aState )
       
   202     {
       
   203     TPtr16 tmpPtr = ( iMsbTagTreeState->Des() );
       
   204     tmpPtr[( iTagTreeInfo->Des() )[aLevel] + aWidth] = aState;
       
   205     }
       
   206 
       
   207 // -----------------------------------------------------------------------------
       
   208 // CJ2kPacket::IncrementMsbTagState
       
   209 // Increment the msb tag tree state at specific level and width
       
   210 // (other items were commented in a header).
       
   211 // -----------------------------------------------------------------------------
       
   212 //
       
   213 inline void CJ2kPacket::IncrementMsbTagState( TUint16 aLevel, TUint16 aWidth )
       
   214     {
       
   215     TPtr16 tmpPtr = ( iMsbTagTreeState->Des() );
       
   216     tmpPtr[( iTagTreeInfo->Des() )[aLevel] + aWidth]++;
       
   217     }
       
   218 
       
   219 // -----------------------------------------------------------------------------
       
   220 // CJ2kPacket::IsHeader
       
   221 // Is packet header has been read
       
   222 // (other items were commented in a header).
       
   223 // -----------------------------------------------------------------------------
       
   224 //
       
   225 inline TUint8 CJ2kPacket::IsHeader() const
       
   226     {
       
   227     return (TUint8)( iReadControl & EReadHeader );
       
   228     }
       
   229 
       
   230 // -----------------------------------------------------------------------------
       
   231 // CJ2kPacket::SetHeader
       
   232 // Set the flag to indicate that packet header has been read
       
   233 // (other items were commented in a header).
       
   234 // -----------------------------------------------------------------------------
       
   235 //
       
   236 inline void CJ2kPacket::SetHeader()
       
   237     {
       
   238     iReadControl |= EReadHeader;
       
   239     }
       
   240 
       
   241 // -----------------------------------------------------------------------------
       
   242 // CJ2kPacket::ResetHeader
       
   243 // Reset the flag to indicate that packet header has not been read
       
   244 // (other items were commented in a header).
       
   245 // -----------------------------------------------------------------------------
       
   246 //
       
   247 inline void CJ2kPacket::ResetHeader()
       
   248     {
       
   249     iReadControl &= ~EReadHeader;
       
   250     }
       
   251 
       
   252 // -----------------------------------------------------------------------------
       
   253 // CJ2kPacket::IsBody
       
   254 // Is packet body has been read
       
   255 // (other items were commented in a header).
       
   256 // -----------------------------------------------------------------------------
       
   257 //
       
   258 inline TUint8 CJ2kPacket::IsBody() const
       
   259     {
       
   260     return (TUint8)( iReadControl & EReadBody );
       
   261     }
       
   262 
       
   263 // -----------------------------------------------------------------------------
       
   264 // CJ2kPacket::SetBody
       
   265 // Set the flag to indicate that packet body has been read
       
   266 // (other items were commented in a header).
       
   267 // -----------------------------------------------------------------------------
       
   268 //
       
   269 inline void CJ2kPacket::SetBody()
       
   270     {
       
   271     iReadControl |= EReadBody;
       
   272     }
       
   273 
       
   274 // -----------------------------------------------------------------------------
       
   275 // CJ2kPacket::ResetBody
       
   276 // Reset the flag to indicate that packet body has not been read
       
   277 // (other items were commented in a header).
       
   278 // -----------------------------------------------------------------------------
       
   279 //
       
   280 inline void CJ2kPacket::ResetBody()
       
   281     {
       
   282     iReadControl &= ~EReadBody;
       
   283     }
       
   284 
       
   285 // -----------------------------------------------------------------------------
       
   286 // CJ2kPacket::SetBodyIncomplete
       
   287 // Set the flag to indicate that packet body read underflow
       
   288 // (other items were commented in a header).
       
   289 // -----------------------------------------------------------------------------
       
   290 //
       
   291 inline void CJ2kPacket::SetBodyIncomplete()
       
   292     {
       
   293     iReadControl |= EReadBodyIncomplete;
       
   294     }
       
   295 
       
   296 // -----------------------------------------------------------------------------
       
   297 // CJ2kPacket::ResetBodyIncomplete
       
   298 // Reset the flag to indicate that packet body read is not underflow
       
   299 // (other items were commented in a header).
       
   300 // -----------------------------------------------------------------------------
       
   301 //
       
   302 inline void CJ2kPacket::ResetBodyIncomplete()
       
   303     {
       
   304     iReadControl &= ~EReadBodyIncomplete;
       
   305     }
       
   306 
       
   307 // -----------------------------------------------------------------------------
       
   308 // CJ2kPacket::IsRecoverFromIncomplete
       
   309 // Is the read recover from previous underflow
       
   310 // (other items were commented in a header).
       
   311 // -----------------------------------------------------------------------------
       
   312 //
       
   313 inline TUint8 CJ2kPacket::IsRecoverFromIncomplete() const
       
   314     {
       
   315     return (TUint8)( iReadControl & EReadRecoverFromIncomplete );
       
   316     }
       
   317 
       
   318 // -----------------------------------------------------------------------------
       
   319 // CJ2kPacket::SetRecoverFromIncomplete
       
   320 // Set the flag to indicate that the next read is recover from underflow
       
   321 // (other items were commented in a header).
       
   322 // -----------------------------------------------------------------------------
       
   323 //
       
   324 inline void CJ2kPacket::SetRecoverFromIncomplete()
       
   325     {
       
   326     iReadControl |= EReadRecoverFromIncomplete;
       
   327     }
       
   328 
       
   329 // -----------------------------------------------------------------------------
       
   330 // CJ2kPacket::ResetRecoverFromIncomplete
       
   331 // Reset the flag to indicate that the next read is not recover from underflow
       
   332 // (other items were commented in a header).
       
   333 // -----------------------------------------------------------------------------
       
   334 //
       
   335 inline void CJ2kPacket::ResetRecoverFromIncomplete()
       
   336     {
       
   337     iReadControl &= ~EReadRecoverFromIncomplete;
       
   338     }
       
   339 
       
   340 // -----------------------------------------------------------------------------
       
   341 // CJ2kPacket::IsMatch
       
   342 // Is codeblock number should iLastCodeBlock
       
   343 // (other items were commented in a header).
       
   344 // -----------------------------------------------------------------------------
       
   345 //
       
   346 inline TUint8 CJ2kPacket::IsMatch() const
       
   347     {
       
   348     return (TUint8)( iReadControl & EReadMatchLastCodeBlock );
       
   349     }
       
   350 
       
   351 // -----------------------------------------------------------------------------
       
   352 // CJ2kPacket::ResetMatch
       
   353 // Reset the flag to indicate that the next codeblock should be greater than 
       
   354 // iLastCodeBlock
       
   355 // (other items were commented in a header).
       
   356 // -----------------------------------------------------------------------------
       
   357 //
       
   358 inline void CJ2kPacket::ResetMatch()
       
   359     {
       
   360     iReadControl &= ~EReadMatchLastCodeBlock;
       
   361     }
       
   362 
       
   363 // -----------------------------------------------------------------------------
       
   364 // CJ2kPacket::SetMatch
       
   365 // Set the flag to indicate that the next codeblock should match iLastCodeBlock
       
   366 // (other items were commented in a header).
       
   367 // -----------------------------------------------------------------------------
       
   368 //
       
   369 inline void CJ2kPacket::SetMatch()
       
   370     {
       
   371     iReadControl |= EReadMatchLastCodeBlock;
       
   372     }
       
   373 
       
   374 #endif // __JP2KPACKET_INL__