imagingmodules/jp2kcodec/Inc/JP2KCodeBlock.h
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:  JP2KCodeBlock class used to collect the codeblock
       
    15 *                related information such as compressed data and data length.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef __JP2KCODEBLOCK_H__
       
    21 #define __JP2KCODEBLOCK_H__
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 
       
    26 // CONSTANTS
       
    27 
       
    28 // MACROS
       
    29 
       
    30 // DATA TYPES
       
    31 
       
    32 // FUNCTION PROTOTYPES
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class CJ2kPacket;
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 /**
       
    40  * JP2KCodeBlock class used to collect the code block
       
    41  * related information such as compressed data, data
       
    42  * length, and etc.
       
    43  *
       
    44  * JP2KCodec.dll
       
    45  * @since 2.6
       
    46  */
       
    47 class CJ2kCodeBlock : public CBase
       
    48     {
       
    49     public:  // Constructors and destructor
       
    50         
       
    51         /**
       
    52         * C++ default constructor.
       
    53         */
       
    54         CJ2kCodeBlock();
       
    55 
       
    56         /**
       
    57         * Destructor.
       
    58         */
       
    59         virtual ~CJ2kCodeBlock();
       
    60 
       
    61     public: // New functions
       
    62         
       
    63         /**
       
    64         * Set the canvas of the code block
       
    65         * @since 2.6
       
    66         * @param aX: x position of the codeblock.
       
    67         * @param aY: y position of the codeblock.
       
    68         * @param aWidth: width of the codeblock.
       
    69         * @param aHeight: height of the codeblock.
       
    70         */
       
    71         void SetCodeBlockCanvas( TInt32 aX, TInt32 aY, TInt32 aWidth, TInt32 aHeight );
       
    72 
       
    73         /**
       
    74         * Initialize the number of segment
       
    75         * @since 2.6
       
    76         * @param aLayer: number of layer.
       
    77         */
       
    78         void InitializeL( TUint16 aLayer );
       
    79 
       
    80         /**
       
    81         * Get the data buffer descriptor
       
    82         * @since 2.6
       
    83         * @return HBufC8*: pointer to the descriptor of the data buffer.
       
    84         */
       
    85         HBufC8* DataL();
       
    86 
       
    87         /**
       
    88         * Get the pointer to the data portion
       
    89         * @since 2.6
       
    90         * @return TUint8*: pointer to the data buffer.
       
    91         */
       
    92         const TUint8* Data() const;
       
    93 
       
    94         /**
       
    95         * Get the last pass
       
    96         * @since 2.6
       
    97         * @return TInt8: the last pass.
       
    98         */
       
    99         TInt8 LastPass() const;
       
   100 
       
   101         /**
       
   102         * Get the pass index
       
   103         * @since 2.6
       
   104         * @return TInt8: the pass index.
       
   105         */
       
   106         TUint8 PassIndex() const;
       
   107 
       
   108         /**
       
   109         * Get the number of empty bit planes
       
   110         * @since 2.6
       
   111         * @return TInt8: the empty bit planes.
       
   112         */
       
   113         TUint8 EmptyBitplanes() const;
       
   114 
       
   115         /**
       
   116         * Get the canvas of the codeblock
       
   117         * @since 2.6
       
   118         * @return TRect&: reference to the canvas of the codeblock.
       
   119         */
       
   120         const TRect& CodeBlockCanvas() const;
       
   121 
       
   122         /**
       
   123         * Get the data length
       
   124         * @since 2.6
       
   125         * @return TInt32: the data length.
       
   126         */
       
   127         TUint32 DataLength() const;
       
   128 
       
   129         /**
       
   130         * Get the data size at specific segment
       
   131         * @since 2.6
       
   132         * @param aIndex: the specific segment.
       
   133         * @return TInt16: the data size at specific segment.
       
   134         */
       
   135         TUint16 CblkLength( TUint16 aIndex ) const;
       
   136 
       
   137         /**
       
   138         * Get the pass per segment at specific segment
       
   139         * @since 2.6
       
   140         * @param aIndex: the specific segment.
       
   141         * @return TInt16: the pass per segment at specific segment.
       
   142         */
       
   143         TUint16 PassesPerSegment( TUint16 aIndex ) const;
       
   144 
       
   145         /**
       
   146         * Reset the pass index to 0
       
   147         * @since 2.6
       
   148         */
       
   149         void ResetPassIndex();
       
   150 
       
   151         /**
       
   152         * Increment the pass index
       
   153         * @since 2.6
       
   154         */
       
   155         void IncrementPassIndex();
       
   156 
       
   157         /**
       
   158         * Set to indicate that the codeblock has been decoded
       
   159         * @since 2.6
       
   160         */
       
   161         void SetCodeBlockDecoded();
       
   162 
       
   163     public: // Functions from base classes
       
   164          
       
   165     protected:  // New functions
       
   166         
       
   167     protected:  // Functions from base classes
       
   168         
       
   169     private:
       
   170 
       
   171     public:     // Data
       
   172     
       
   173     protected:  // Data
       
   174 
       
   175     private:    // Data
       
   176 
       
   177         // Last pass
       
   178         TInt8 iLastPass;        
       
   179 
       
   180         // Pass index
       
   181         TUint8 iPassIndex;       
       
   182         
       
   183         // Empty bit plane
       
   184         TUint8 iEmptyBitplane;
       
   185 
       
   186         // Bits length
       
   187         TUint8 iLengthBits;      
       
   188 
       
   189         // Data length
       
   190         TUint32 iDataLength;      
       
   191 
       
   192         // Data size of each segment
       
   193         HBufC16 *iDataSize;        
       
   194 
       
   195         // Number of pass per segment
       
   196         HBufC16 *iPassesPerSegment;
       
   197 
       
   198         // Number of segment
       
   199         HBufC16 *iNumSegment;      
       
   200 
       
   201         // Canvas of the code block
       
   202         TRect iCodeBlockCanvas; 
       
   203 
       
   204         // Compressed image data
       
   205         HBufC8 *iData;           
       
   206         
       
   207         // True if codeblock has been decoded
       
   208         TUint8 iIsDecoded;       
       
   209 
       
   210     public:     // Friend classes
       
   211         friend class CJ2kPacket;
       
   212 
       
   213     protected:  // Friend classes
       
   214         
       
   215     private:    // Friend classes        
       
   216     };
       
   217 
       
   218 // For inliners.
       
   219 #include "JP2KCodeBlock.inl"
       
   220 
       
   221 #endif // __JP2KCODEBLOCK_H__
       
   222