Changeset 1313 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComPicYuv.h


Ignore:
Timestamp:
13 Aug 2015, 17:38:13 (9 years ago)
Author:
tech
Message:

Merged 14.1-update-dev1@1312.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibCommon/TComPicYuv.h

    r1179 r1313  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
     4 * granted under this license.
    55 *
    6 * Copyright (c) 2010-2015, ITU/ISO/IEC
     6 * Copyright (c) 2010-2015, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    4242#include "CommonDef.h"
    4343#include "TComRom.h"
     44#include "TComChromaFormat.h"
     45#include "SEI.h"
    4446
    4547//! \ingroup TLibCommon
     
    5456{
    5557private:
    56  
     58
    5759  // ------------------------------------------------------------------------------------------------
    5860  //  YUV buffer
    5961  // ------------------------------------------------------------------------------------------------
    60  
    61   Pel*  m_apiPicBufY;           ///< Buffer (including margin)
    62   Pel*  m_apiPicBufU;
    63   Pel*  m_apiPicBufV;
    64  
    65   Pel*  m_piPicOrgY;            ///< m_apiPicBufY + m_iMarginLuma*getStride() + m_iMarginLuma
    66   Pel*  m_piPicOrgU;
    67   Pel*  m_piPicOrgV;
    68  
     62
     63  Pel*  m_apiPicBuf[MAX_NUM_COMPONENT];             ///< Buffer (including margin)
     64
     65  Pel*  m_piPicOrg[MAX_NUM_COMPONENT];              ///< m_apiPicBufY + m_iMarginLuma*getStride() + m_iMarginLuma
     66
    6967  // ------------------------------------------------------------------------------------------------
    7068  //  Parameter for general YUV buffer usage
    7169  // ------------------------------------------------------------------------------------------------
    72  
    73   Int   m_iPicWidth;            ///< Width of picture
    74   Int   m_iPicHeight;           ///< Height of picture
    75  
    76   Int   m_iCuWidth;             ///< Width of Coding Unit (CU)
    77   Int   m_iCuHeight;            ///< Height of Coding Unit (CU)
    78   Int*  m_cuOffsetY;
    79   Int*  m_cuOffsetC;
    80   Int*  m_buOffsetY;
    81   Int*  m_buOffsetC;
    82  
    83   Int   m_iLumaMarginX;
    84   Int   m_iLumaMarginY;
    85   Int   m_iChromaMarginX;
    86   Int   m_iChromaMarginY;
    87  
     70
     71  Int   m_iPicWidth;                                ///< Width of picture in pixels
     72  Int   m_iPicHeight;                               ///< Height of picture in pixels
     73  ChromaFormat m_chromaFormatIDC;                   ///< Chroma Format
     74
     75  Int*  m_ctuOffsetInBuffer[MAX_NUM_CHANNEL_TYPE];  ///< Gives an offset in the buffer for a given CTU (and channel)
     76  Int*  m_subCuOffsetInBuffer[MAX_NUM_CHANNEL_TYPE];///< Gives an offset in the buffer for a given sub-CU (and channel), relative to start of CTU
     77
     78  Int   m_iMarginX;                                 ///< margin of Luma channel (chroma's may be smaller, depending on ratio)
     79  Int   m_iMarginY;                                 ///< margin of Luma channel (chroma's may be smaller, depending on ratio)
     80
    8881  Bool  m_bIsBorderExtended;
    89  
    90 #if H_3D_IV_MERGE
     82#if NH_3D_IV_MERGE
    9183  Int   m_iBaseUnitWidth;       ///< Width of Base Unit (with maximum depth or minimum size, m_iCuWidth >> Max. Depth)
    9284  Int   m_iBaseUnitHeight;      ///< Height of Base Unit (with maximum depth or minimum size, m_iCuHeight >> Max. Depth)
    9385  Int   m_iNumCuInWidth;
     86  Int   m_iCuWidth;             ///< Width of Coding Unit (CU)
     87  Int   m_iCuHeight;            ///< Height of Coding Unit (CU)
    9488#endif
    95 protected:
    96   Void  xExtendPicCompBorder (Pel* piTxt, Int iStride, Int iWidth, Int iHeight, Int iMarginX, Int iMarginY);
    97 #if H_3D
     89
     90#if NH_3D_VSO
    9891  Void  xSetPels( Pel* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Pel iVal );
    9992#endif
    100  
     93
    10194public:
    102   TComPicYuv         ();
    103   virtual ~TComPicYuv();
    104  
     95               TComPicYuv         ();
     96  virtual     ~TComPicYuv         ();
     97
    10598  // ------------------------------------------------------------------------------------------------
    10699  //  Memory management
    107100  // ------------------------------------------------------------------------------------------------
    108  
    109   Void  create      ( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth );
    110   Void  destroy     ();
    111  
    112   Void  createLuma  ( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uhMaxCUDepth );
    113   Void  destroyLuma ();
    114  
     101
     102  Void          create            (const Int iPicWidth,
     103                                   const Int iPicHeight,
     104                                   const ChromaFormat chromaFormatIDC,
     105                                   const UInt uiMaxCUWidth,  ///< used for generating offsets to CUs. Can use iPicWidth if no offsets are required
     106                                   const UInt uiMaxCUHeight, ///< used for generating offsets to CUs. Can use iPicHeight if no offsets are required
     107                                   const UInt uiMaxCUDepth,  ///< used for generating offsets to CUs. Can use 0 if no offsets are required
     108                                   const Bool bUseMargin);   ///< if true, then a margin of uiMaxCUWidth+16 and uiMaxCUHeight+16 is created around the image.
     109
     110  Void          destroy           ();
     111
     112  // The following have been removed - Use CHROMA_400 in the above function call.
     113  //Void  createLuma  ( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uhMaxCUDepth );
     114  //Void  destroyLuma ();
     115
    115116  // ------------------------------------------------------------------------------------------------
    116117  //  Get information of picture
    117118  // ------------------------------------------------------------------------------------------------
    118  
    119   Int   getWidth    ()     { return  m_iPicWidth;    }
    120   Int   getHeight   ()     { return  m_iPicHeight;   }
    121  
    122   Int   getStride   ()     { return (m_iPicWidth     ) + (m_iLumaMarginX  <<1); }
    123   Int   getCStride  ()     { return (m_iPicWidth >> 1) + (m_iChromaMarginX<<1); }
    124  
    125   Int   getLumaMargin   () { return m_iLumaMarginX;  }
    126   Int   getChromaMargin () { return m_iChromaMarginX;}
    127  
     119
     120  Int           getWidth          (const ComponentID id) const { return  m_iPicWidth >> getComponentScaleX(id);   }
     121  Int           getHeight         (const ComponentID id) const { return  m_iPicHeight >> getComponentScaleY(id);  }
     122  ChromaFormat  getChromaFormat   ()                     const { return m_chromaFormatIDC; }
     123  UInt          getNumberValidComponents() const { return ::getNumberValidComponents(m_chromaFormatIDC); }
     124
     125  Int           getStride         (const ComponentID id) const { return ((m_iPicWidth     ) + (m_iMarginX  <<1)) >> getComponentScaleX(id); }
     126  Int           getTotalHeight    (const ComponentID id) const { return ((m_iPicHeight    ) + (m_iMarginY  <<1)) >> getComponentScaleY(id); }
     127
     128  Int           getMarginX        (const ComponentID id) const { return m_iMarginX >> getComponentScaleX(id);  }
     129  Int           getMarginY        (const ComponentID id) const { return m_iMarginY >> getComponentScaleY(id);  }
     130
    128131  // ------------------------------------------------------------------------------------------------
    129132  //  Access function for picture buffer
    130133  // ------------------------------------------------------------------------------------------------
    131  
     134
    132135  //  Access starting position of picture buffer with margin
    133   Pel*  getBufY     ()     { return  m_apiPicBufY;   }
    134   Pel*  getBufU     ()     { return  m_apiPicBufU;   }
    135   Pel*  getBufV     ()     { return  m_apiPicBufV;   }
    136  
     136  Pel*          getBuf            (const ComponentID ch)       { return  m_apiPicBuf[ch];   }
     137
    137138  //  Access starting position of original picture
    138   Pel*  getLumaAddr ()     { return  m_piPicOrgY;    }
    139   Pel*  getCbAddr   ()     { return  m_piPicOrgU;    }
    140   Pel*  getCrAddr   ()     { return  m_piPicOrgV;    }
    141  
     139  Pel*          getAddr           (const ComponentID ch)       { return  m_piPicOrg[ch];   }
     140  const Pel*    getAddr           (const ComponentID ch) const { return  m_piPicOrg[ch];   }
     141
    142142  //  Access starting position of original picture for specific coding unit (CU) or partition unit (PU)
    143   Pel*  getLumaAddr ( Int iCuAddr ) { return m_piPicOrgY + m_cuOffsetY[ iCuAddr ]; }
    144   Pel*  getCbAddr   ( Int iCuAddr ) { return m_piPicOrgU + m_cuOffsetC[ iCuAddr ]; }
    145   Pel*  getCrAddr   ( Int iCuAddr ) { return m_piPicOrgV + m_cuOffsetC[ iCuAddr ]; }
    146   Pel*  getLumaAddr ( Int iCuAddr, Int uiAbsZorderIdx ) { return m_piPicOrgY + m_cuOffsetY[iCuAddr] + m_buOffsetY[g_auiZscanToRaster[uiAbsZorderIdx]]; }
    147   Pel*  getCbAddr   ( Int iCuAddr, Int uiAbsZorderIdx ) { return m_piPicOrgU + m_cuOffsetC[iCuAddr] + m_buOffsetC[g_auiZscanToRaster[uiAbsZorderIdx]]; }
    148   Pel*  getCrAddr   ( Int iCuAddr, Int uiAbsZorderIdx ) { return m_piPicOrgV + m_cuOffsetC[iCuAddr] + m_buOffsetC[g_auiZscanToRaster[uiAbsZorderIdx]]; }
    149  
     143  Pel*          getAddr           (const ComponentID ch, const Int ctuRSAddr )       { return m_piPicOrg[ch] + m_ctuOffsetInBuffer[ch==0?0:1][ ctuRSAddr ]; }
     144  const Pel*    getAddr           (const ComponentID ch, const Int ctuRSAddr ) const { return m_piPicOrg[ch] + m_ctuOffsetInBuffer[ch==0?0:1][ ctuRSAddr ]; }
     145  Pel*          getAddr           (const ComponentID ch, const Int ctuRSAddr, const Int uiAbsZorderIdx )
     146                                     { return m_piPicOrg[ch] + m_ctuOffsetInBuffer[ch==0?0:1][ctuRSAddr] + m_subCuOffsetInBuffer[ch==0?0:1][g_auiZscanToRaster[uiAbsZorderIdx]]; }
     147  const Pel*    getAddr           (const ComponentID ch, const Int ctuRSAddr, const Int uiAbsZorderIdx ) const
     148                                     { return m_piPicOrg[ch] + m_ctuOffsetInBuffer[ch==0?0:1][ctuRSAddr] + m_subCuOffsetInBuffer[ch==0?0:1][g_auiZscanToRaster[uiAbsZorderIdx]]; }
     149
     150  UInt          getComponentScaleX(const ComponentID id) const { return ::getComponentScaleX(id, m_chromaFormatIDC); }
     151  UInt          getComponentScaleY(const ComponentID id) const { return ::getComponentScaleY(id, m_chromaFormatIDC); }
     152
    150153  // ------------------------------------------------------------------------------------------------
    151154  //  Miscellaneous
    152155  // ------------------------------------------------------------------------------------------------
    153  
     156
    154157  //  Copy function to picture
    155   Void  copyToPic       ( TComPicYuv*  pcPicYuvDst );
    156   Void  copyToPicLuma   ( TComPicYuv*  pcPicYuvDst );
    157   Void  copyToPicCb     ( TComPicYuv*  pcPicYuvDst );
    158   Void  copyToPicCr     ( TComPicYuv*  pcPicYuvDst );
    159  
     158  Void          copyToPic         ( TComPicYuv*  pcPicYuvDst ) const ;
     159
    160160  //  Extend function of picture buffer
    161   Void  extendPicBorder      ();
    162  
     161  Void          extendPicBorder   ();
     162
    163163  //  Dump picture
    164   Void  dump (Char* pFileName, Bool bAdd = false);
    165  
     164  Void          dump              (const Char* pFileName, const BitDepths &bitDepths, Bool bAdd = false) const ;
     165
    166166  // Set border extension flag
    167   Void  setBorderExtension(Bool b) { m_bIsBorderExtended = b; }
    168 #if H_3D
     167  Void          setBorderExtension(Bool b) { m_bIsBorderExtended = b; }
     168#if NH_3D
    169169  // Set Function
    170170  Void  setLumaTo    ( Pel pVal ); 
    171171  Void  setChromaTo  ( Pel pVal ); 
    172 #if H_3D_IV_MERGE
     172#if NH_3D_IV_MERGE
    173173  // sample to block and block to sample conversion
    174174  Void  getTopLeftSamplePos( Int iCuAddr, Int iAbsZorderIdx, Int& riX, Int& riY );
     
    176176#endif
    177177#endif
     178
    178179};// END CLASS DEFINITION TComPicYuv
    179180
    180 void calcChecksum(TComPicYuv& pic, UChar digest[3][16]);
    181 void calcCRC(TComPicYuv& pic, UChar digest[3][16]);
    182 void calcMD5(TComPicYuv& pic, UChar digest[3][16]);
     181
     182// These functions now return the length of the digest strings.
     183UInt calcChecksum(const TComPicYuv& pic, TComPictureHash &digest, const BitDepths &bitDepths);
     184UInt calcCRC     (const TComPicYuv& pic, TComPictureHash &digest, const BitDepths &bitDepths);
     185UInt calcMD5     (const TComPicYuv& pic, TComPictureHash &digest, const BitDepths &bitDepths);
     186std::string hashToString(const TComPictureHash &digest, Int numChar);
    183187//! \}
    184188
Note: See TracChangeset for help on using the changeset viewer.