Changeset 1287 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibCommon


Ignore:
Timestamp:
17 Jul 2015, 05:43:37 (11 years ago)
Author:
seregin
Message:

port rev 4322 (g_bitDepth)

Location:
branches/SHM-dev/source/Lib/TLibCommon
Files:
30 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/Lib/TLibCommon/CommonDef.h

    r1283 r1287  
    144144// ====================================================================================================================
    145145
    146 extern Int g_bitDepth[MAX_NUM_CHANNEL_TYPE];
    147 
    148 #if SVC_EXTENSION
    149 extern Int  g_bitDepthLayer[MAX_NUM_CHANNEL_TYPE][MAX_LAYERS];
    150 extern void* g_refWeightACDCParam; //type:wpACDCParam
    151 #endif
    152 
    153146template <typename T> inline T Clip3 (const T minVal, const T maxVal, const T a) { return std::min<T> (std::max<T> (minVal, a) , maxVal); }  ///< general min/max clip
    154147template <typename T> inline T ClipBD(const T x, const Int bitDepth)             { return Clip3(T(0), T((1 << bitDepth)-1), x);           }
    155 template <typename T> inline T Clip  (const T x, const ChannelType type)         { return ClipBD(x, g_bitDepth[type]);                    }
    156148
    157149template <typename T> inline Void Check3( T minVal, T maxVal, T a)
  • branches/SHM-dev/source/Lib/TLibCommon/TComChromaFormat.h

    r1285 r1287  
    163163//------------------------------------------------
    164164
    165 static inline Int getTransformShift(const ChannelType type, const UInt uiLog2TrSize, const Int maxLog2TrDynamicRange)
    166 {
    167 #if O0043_BEST_EFFORT_DECODING
    168   return maxLog2TrDynamicRange - g_bitDepthInStream[type] - uiLog2TrSize;
    169 #else
    170   return maxLog2TrDynamicRange - g_bitDepth[type] - uiLog2TrSize;
    171 #endif
     165static inline Int getTransformShift(const Int channelBitDepth, const UInt uiLog2TrSize, const Int maxLog2TrDynamicRange)
     166{
     167  return maxLog2TrDynamicRange - channelBitDepth - uiLog2TrSize;
    172168}
    173169
  • branches/SHM-dev/source/Lib/TLibCommon/TComInterpolationFilter.cpp

    r1260 r1287  
    338338 * \param  fmt        Chroma format
    339339 */
    340 Void TComInterpolationFilter::filterHor(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast, const ChromaFormat fmt )
     340Void TComInterpolationFilter::filterHor(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast, const ChromaFormat fmt, const Int bitDepth )
    341341{
    342342  if ( frac == 0 )
    343343  {
    344     filterCopy(g_bitDepth[toChannelType(compID)], src, srcStride, dst, dstStride, width, height, true, isLast );
     344    filterCopy(bitDepth, src, srcStride, dst, dstStride, width, height, true, isLast );
    345345  }
    346346  else if (isLuma(compID))
    347347  {
    348348    assert(frac >= 0 && frac < LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS);
    349     filterHor<NTAPS_LUMA>(g_bitDepth[toChannelType(compID)], src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter[frac]);
     349    filterHor<NTAPS_LUMA>(bitDepth, src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter[frac]);
    350350  }
    351351  else
     
    353353    const UInt csx = getComponentScaleX(compID, fmt);
    354354    assert(frac >=0 && csx<2 && (frac<<(1-csx)) < CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS);
    355     filterHor<NTAPS_CHROMA>(g_bitDepth[toChannelType(compID)], src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilter[frac<<(1-csx)]);
     355    filterHor<NTAPS_CHROMA>(bitDepth, src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilter[frac<<(1-csx)]);
    356356  }
    357357}
     
    373373 * \param  fmt        Chroma format
    374374 */
    375 Void TComInterpolationFilter::filterVer(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast, const ChromaFormat fmt )
     375Void TComInterpolationFilter::filterVer(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast, const ChromaFormat fmt, const Int bitDepth )
    376376{
    377377  if ( frac == 0 )
    378378  {
    379     filterCopy(g_bitDepth[toChannelType(compID)], src, srcStride, dst, dstStride, width, height, isFirst, isLast );
     379    filterCopy(bitDepth, src, srcStride, dst, dstStride, width, height, isFirst, isLast );
    380380  }
    381381  else if (isLuma(compID))
    382382  {
    383383    assert(frac >= 0 && frac < LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS);
    384     filterVer<NTAPS_LUMA>(g_bitDepth[toChannelType(compID)], src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilter[frac]);
     384    filterVer<NTAPS_LUMA>(bitDepth, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilter[frac]);
    385385  }
    386386  else
     
    388388    const UInt csy = getComponentScaleY(compID, fmt);
    389389    assert(frac >=0 && csy<2 && (frac<<(1-csy)) < CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS);
    390     filterVer<NTAPS_CHROMA>(g_bitDepth[toChannelType(compID)], src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilter[frac<<(1-csy)]);
     390    filterVer<NTAPS_CHROMA>(bitDepth, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilter[frac<<(1-csy)]);
    391391  }
    392392}
  • branches/SHM-dev/source/Lib/TLibCommon/TComInterpolationFilter.h

    r1259 r1287  
    7373  ~TComInterpolationFilter() {}
    7474
    75   Void filterHor(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac,               Bool isLast, const ChromaFormat fmt );
    76   Void filterVer(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast, const ChromaFormat fmt );
     75  Void filterHor(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac,               Bool isLast, const ChromaFormat fmt, const Int bitDepth );
     76  Void filterVer(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast, const ChromaFormat fmt, const Int bitDepth );
    7777};
    7878
  • branches/SHM-dev/source/Lib/TLibCommon/TComLoopFilter.cpp

    r1260 r1287  
    564564  Pel* piSrc    = pcPicYuvRec->getAddr(COMPONENT_Y, pcCU->getCtuRsAddr(), uiAbsZorderIdx );
    565565  Pel* piTmpSrc = piSrc;
     566#if SVC_EXTENSION
     567  const Int bitDepthLuma = pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_LUMA);
     568#else
     569  const Int bitDepthLuma = pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA);
     570#endif
    566571
    567572  const Bool lfCrossSliceBoundaryFlag=pcCU->getSlice()->getLFCrossSliceBoundaryFlag();
     
    600605  }
    601606
     607  const Int iBitdepthScale = 1 << (bitDepthLuma-8);
     608
    602609  for ( UInt iIdx = 0; iIdx < uiNumParts; iIdx++ )
    603610  {
     
    620627      iQP_P = pcCUP->getQP(uiPartPIdx);
    621628      iQP = (iQP_P + iQP_Q + 1) >> 1;
    622       Int iBitdepthScale = 1 << (g_bitDepth[CHANNEL_TYPE_LUMA]-8);
    623629
    624630      Int iIndexTC = Clip3(0, MAX_QP+DEFAULT_INTRA_TC_OFFSET, Int(iQP + DEFAULT_INTRA_TC_OFFSET*(uiBs-1) + (tcOffsetDiv2 << 1)));
     
    666672          for ( Int i = 0; i < DEBLOCK_SMALLEST_BLOCK/2; i++)
    667673          {
    668             xPelFilterLuma( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*4+i), iOffset, iTc, sw, bPartPNoFilter, bPartQNoFilter, iThrCut, bFilterP, bFilterQ);
     674            xPelFilterLuma( piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*4+i), iOffset, iTc, sw, bPartPNoFilter, bPartQNoFilter, iThrCut, bFilterP, bFilterQ, bitDepthLuma);
    669675          }
    670676        }
     
    681687  Pel*        piSrcCb     = pcPicYuvRec->getAddr( COMPONENT_Cb, pcCU->getCtuRsAddr(), uiAbsZorderIdx );
    682688  Pel*        piSrcCr     = pcPicYuvRec->getAddr( COMPONENT_Cr, pcCU->getCtuRsAddr(), uiAbsZorderIdx );
     689#if SVC_EXTENSION
     690  const Int bitDepthChroma = pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_CHROMA);
     691#else
     692  const Int bitDepthChroma = pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA);
     693#endif
    683694  Int iQP = 0;
    684695  Int iQP_P = 0;
     
    740751    uiLoopLength=uiPelsInPartChromaH;
    741752  }
     753
     754#if SVC_EXTENSION
     755  const Int iBitdepthScale = 1 << (pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_CHROMA)-8);
     756#else
     757  const Int iBitdepthScale = 1 << (pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA)-8);
     758#endif
    742759
    743760  for ( UInt iIdx = 0; iIdx < uiNumParts; iIdx++ )
     
    798815        }
    799816
    800         Int iBitdepthScale = 1 << (g_bitDepth[CHANNEL_TYPE_CHROMA]-8);
    801 
    802817        Int iIndexTC = Clip3(0, MAX_QP+DEFAULT_INTRA_TC_OFFSET, iQP + DEFAULT_INTRA_TC_OFFSET*(ucBs - 1) + (tcOffsetDiv2 << 1));
    803818        Int iTc =  sm_tcTable[iIndexTC]*iBitdepthScale;
     
    805820        for ( UInt uiStep = 0; uiStep < uiLoopLength; uiStep++ )
    806821        {
    807           xPelFilterChroma( piTmpSrcChroma + iSrcStep*(uiStep+iIdx*uiLoopLength), iOffset, iTc , bPartPNoFilter, bPartQNoFilter);
     822          xPelFilterChroma( piTmpSrcChroma + iSrcStep*(uiStep+iIdx*uiLoopLength), iOffset, iTc , bPartPNoFilter, bPartQNoFilter, bitDepthChroma);
    808823        }
    809824      }
     
    825840 \param bFilterSecondQ  decision weak filter/no filter for partQ
    826841*/
    827 __inline Void TComLoopFilter::xPelFilterLuma( Pel* piSrc, Int iOffset, Int tc, Bool sw, Bool bPartPNoFilter, Bool bPartQNoFilter, Int iThrCut, Bool bFilterSecondP, Bool bFilterSecondQ)
     842__inline Void TComLoopFilter::xPelFilterLuma( Pel* piSrc, Int iOffset, Int tc, Bool sw, Bool bPartPNoFilter, Bool bPartQNoFilter, Int iThrCut, Bool bFilterSecondP, Bool bFilterSecondQ, const Int bitDepthLuma)
    828843{
    829844  Int delta;
     
    855870    {
    856871      delta = Clip3(-tc, tc, delta);
    857       piSrc[-iOffset] = Clip((m3+delta), CHANNEL_TYPE_LUMA);
    858       piSrc[0] = Clip((m4-delta), CHANNEL_TYPE_LUMA);
     872      piSrc[-iOffset] = ClipBD((m3+delta), bitDepthLuma);
     873      piSrc[0] = ClipBD((m4-delta), bitDepthLuma);
    859874
    860875      Int tc2 = tc>>1;
     
    862877      {
    863878        Int delta1 = Clip3(-tc2, tc2, (( ((m1+m3+1)>>1)- m2+delta)>>1));
    864         piSrc[-iOffset*2] = Clip((m2+delta1), CHANNEL_TYPE_LUMA);
     879        piSrc[-iOffset*2] = ClipBD((m2+delta1), bitDepthLuma);
    865880      }
    866881      if(bFilterSecondQ)
    867882      {
    868883        Int delta2 = Clip3(-tc2, tc2, (( ((m6+m4+1)>>1)- m5-delta)>>1));
    869         piSrc[ iOffset] = Clip((m5+delta2), CHANNEL_TYPE_LUMA);
     884        piSrc[ iOffset] = ClipBD((m5+delta2), bitDepthLuma);
    870885      }
    871886    }
     
    895910 \param bPartQNoFilter  indicator to disable filtering on partQ
    896911 */
    897 __inline Void TComLoopFilter::xPelFilterChroma( Pel* piSrc, Int iOffset, Int tc, Bool bPartPNoFilter, Bool bPartQNoFilter)
     912__inline Void TComLoopFilter::xPelFilterChroma( Pel* piSrc, Int iOffset, Int tc, Bool bPartPNoFilter, Bool bPartQNoFilter, const Int bitDepthChroma)
    898913{
    899914  Int delta;
     
    905920
    906921  delta = Clip3(-tc,tc, (((( m4 - m3 ) << 2 ) + m2 - m5 + 4 ) >> 3) );
    907   piSrc[-iOffset] = Clip((m3+delta), CHANNEL_TYPE_CHROMA);
    908   piSrc[0] = Clip((m4-delta), CHANNEL_TYPE_CHROMA);
     922  piSrc[-iOffset] = ClipBD((m3+delta), bitDepthChroma);
     923  piSrc[0] = ClipBD((m4-delta), bitDepthChroma);
    909924
    910925  if(bPartPNoFilter)
  • branches/SHM-dev/source/Lib/TLibCommon/TComLoopFilter.h

    r1259 r1287  
    108108  Void xEdgeFilterChroma          ( TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth, DeblockEdgeDir edgeDir, Int iEdge );
    109109
    110   __inline Void xPelFilterLuma( Pel* piSrc, Int iOffset, Int tc, Bool sw, Bool bPartPNoFilter, Bool bPartQNoFilter, Int iThrCut, Bool bFilterSecondP, Bool bFilterSecondQ);
    111   __inline Void xPelFilterChroma( Pel* piSrc, Int iOffset, Int tc, Bool bPartPNoFilter, Bool bPartQNoFilter);
     110  __inline Void xPelFilterLuma( Pel* piSrc, Int iOffset, Int tc, Bool sw, Bool bPartPNoFilter, Bool bPartQNoFilter, Int iThrCut, Bool bFilterSecondP, Bool bFilterSecondQ, const Int bitDepthLuma);
     111  __inline Void xPelFilterChroma( Pel* piSrc, Int iOffset, Int tc, Bool bPartPNoFilter, Bool bPartQNoFilter, const Int bitDepthChroma);
    112112
    113113
  • branches/SHM-dev/source/Lib/TLibCommon/TComPattern.cpp

    r1260 r1287  
    7979                                           Int iRoiWidth,
    8080                                           Int iRoiHeight,
    81                                            Int iStride
     81                                           Int iStride,
     82                                           Int bitDepth
    8283                                           )
    8384{
    8485  m_piROIOrigin    = piTexture;
    85   m_iROIWidth       = iRoiWidth;
    86   m_iROIHeight      = iRoiHeight;
    87   m_iPatternStride  = iStride;
     86  m_iROIWidth      = iRoiWidth;
     87  m_iROIHeight     = iRoiHeight;
     88  m_iPatternStride = iStride;
     89  m_bitDepth       = bitDepth;
    8890}
    8991
     
    9597                               Int iRoiWidth,
    9698                               Int iRoiHeight,
    97                                Int iStride)
    98 {
    99   m_cPatternY. setPatternParamPel( piY,  iRoiWidth, iRoiHeight, iStride);
     99                               Int iStride,
     100                               Int bitDepthLuma)
     101{
     102  m_cPatternY. setPatternParamPel( piY,  iRoiWidth, iRoiHeight, iStride, bitDepthLuma);
    100103}
    101104
     
    120123  const Int  iAboveUnits      = iTUWidthInUnits  << 1;
    121124  const Int  iLeftUnits       = iTUHeightInUnits << 1;
     125#if SVC_EXTENSION
     126  const Int  bitDepthForChannel = pcCU->getSlice()->getBitDepth(chType);
     127#else
     128  const Int  bitDepthForChannel = pcCU->getSlice()->getSPS()->getBitDepth(chType);
     129#endif
    122130
    123131  assert(iTUHeightInUnits > 0 && iTUWidthInUnits > 0);
     
    156164    Pel *piRoiOrigin = pcCU->getPic()->getPicYuvRec()->getAddr(compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu()+uiZorderIdxInPart);
    157165#if O0043_BEST_EFFORT_DECODING
    158     fillReferenceSamples (g_bitDepthInStream[chType], g_bitDepthInStream[chType] - g_bitDepth[chType], pcCU, piRoiOrigin, piAdiTemp, bNeighborFlags, iNumIntraNeighbor,  iUnitWidth, iUnitHeight, iAboveUnits, iLeftUnits,
    159 #else
    160     fillReferenceSamples (g_bitDepth[chType], pcCU, piRoiOrigin, piAdiTemp, bNeighborFlags, iNumIntraNeighbor,  iUnitWidth, iUnitHeight, iAboveUnits, iLeftUnits,
     166    const Int  bitDepthForChannelInStream = pcCU->getSlice()->getSPS()->getStreamBitDepth(chType);
     167    fillReferenceSamples (bitDepthForChannelInStream, bitDepthForChannelInStream - bitDepthForChannel, pcCU, piRoiOrigin, piAdiTemp, bNeighborFlags, iNumIntraNeighbor,  iUnitWidth, iUnitHeight, iAboveUnits, iLeftUnits,
     168#else
     169    fillReferenceSamples (bitDepthForChannel, pcCU, piRoiOrigin, piAdiTemp, bNeighborFlags, iNumIntraNeighbor,  iUnitWidth, iUnitHeight, iAboveUnits, iLeftUnits,
    161170#endif
    162171                          uiTuWidth, uiTuHeight, uiROIWidth, uiROIHeight, iPicStride, toChannelType(compID), chFmt);
     
    202211      {
    203212#if O0043_BEST_EFFORT_DECODING
    204         const Int  threshold     = 1 << (g_bitDepthInStream[chType] - 5);
    205 #else
    206         const Int  threshold     = 1 << (g_bitDepth[chType] - 5);
     213        const Int  threshold     = 1 << (bitDepthForChannelInStream - 5);
     214#else
     215        const Int  threshold     = 1 << (bitDepthForChannel - 5);
    207216#endif
    208217        const Bool bilinearLeft  = abs((bottomLeft + topLeft ) - (2 * piAdiTemp[stride * uiTuHeight])) < threshold; //difference between the
  • branches/SHM-dev/source/Lib/TLibCommon/TComPattern.h

    r1262 r1287  
    6262  Int   m_iROIHeight;
    6363  Int   m_iPatternStride;
     64  Int   m_bitDepth;
    6465
    6566  /// return starting position of ROI (ROI = &pattern[AboveOffset][LeftOffset])
     
    7071
    7172  /// set parameters from Pel buffer for accessing neighbouring pixels
    72   Void setPatternParamPel (Pel*        piTexture,
    73                            Int         iRoiWidth,
    74                            Int         iRoiHeight,
    75                            Int         iStride
    76                            );
     73  Void setPatternParamPel( Pel* piTexture, Int iRoiWidth, Int iRoiHeight, Int iStride, Int bitDepth );
    7774};
    7875
     
    9289  Int   getROIYHeight()           { return m_cPatternY.m_iROIHeight;      }
    9390  Int   getPatternLStride()       { return m_cPatternY.m_iPatternStride;  }
     91  Int   getBitDepthY()            { return m_cPatternY.m_bitDepth; }
    9492
    9593  // -------------------------------------------------------------------------------------------------------------------
     
    9896
    9997  /// set parameters from Pel buffers for accessing neighbouring pixels
    100   Void initPattern            (Pel*        piY,
    101                                Int         iRoiWidth,
    102                                Int         iRoiHeight,
    103                                Int         iStride );
    104 
    105 
    106 
    107 
     98  Void initPattern( Pel* piY, Int iRoiWidth, Int iRoiHeight, Int iStride, Int bitDepthLuma );
    10899};
    109100
  • branches/SHM-dev/source/Lib/TLibCommon/TComPicYuv.cpp

    r1259 r1287  
    256256
    257257// NOTE: This function is never called, but may be useful for developers.
    258 Void TComPicYuv::dump (const Char* pFileName, Bool bAdd) const
     258Void TComPicYuv::dump (const Char* pFileName, const BitDepths &bitDepths, Bool bAdd) const
    259259{
    260260  FILE* pFile;
     
    272272  {
    273273    const ComponentID  ch     = ComponentID(chan);
    274     const Int          shift  = g_bitDepth[toChannelType(ch)] - 8;
     274    const Int          shift  = bitDepths.recon[toChannelType(ch)] - 8;
    275275    const Int          offset = (shift>0)?(1<<(shift-1)):0;
    276276    const Pel         *pi     = getAddr(ch);
     
    307307  if( bitDepth == 8 )
    308308  {
    309     dump( pFileName, bAdd );
     309    dump( pFileName, bitDepth, bAdd );
    310310    return;
    311311  }
     
    338338
    339339#if AUXILIARY_PICTURES
    340 Void TComPicYuv::convertToMonochrome()
    341 {
    342   Pel grayVal = (1 << (g_bitDepth[CHANNEL_TYPE_CHROMA] - 1));
     340Void TComPicYuv::convertToMonochrome(Int bitDepthChroma)
     341{
     342  Pel grayVal = (1 << (bitDepthChroma - 1));
    343343
    344344  for( UInt comp = 1; comp < getNumberValidComponents(); comp++ )
  • branches/SHM-dev/source/Lib/TLibCommon/TComPicYuv.h

    r1273 r1287  
    160160
    161161  //  Dump picture
    162   Void          dump              (const Char* pFileName, Bool bAdd = false) const ;
     162  Void          dump              (const Char* pFileName, const BitDepths &bitDepths, Bool bAdd = false) const ;
    163163
    164164  // Set border extension flag
     
    172172  Bool          isReconstructed()                                { return m_isReconstructed;                }
    173173#if AUXILIARY_PICTURES 
    174   Void          convertToMonochrome();
     174  Void          convertToMonochrome(Int bitDepthChroma);
    175175#endif
    176176#endif
     
    182182
    183183// These functions now return the length of the digest strings.
    184 UInt calcChecksum(const TComPicYuv& pic, TComPictureHash &digest);
    185 UInt calcCRC     (const TComPicYuv& pic, TComPictureHash &digest);
    186 UInt calcMD5     (const TComPicYuv& pic, TComPictureHash &digest);
     184UInt calcChecksum(const TComPicYuv& pic, TComPictureHash &digest, const BitDepths &bitDepths);
     185UInt calcCRC     (const TComPicYuv& pic, TComPictureHash &digest, const BitDepths &bitDepths);
     186UInt calcMD5     (const TComPicYuv& pic, TComPictureHash &digest, const BitDepths &bitDepths);
    187187std::string hashToString(const TComPictureHash &digest, Int numChar);
    188188//! \}
  • branches/SHM-dev/source/Lib/TLibCommon/TComPicYuvMD5.cpp

    r1273 r1287  
    127127}
    128128
    129 UInt calcCRC(const TComPicYuv& pic, TComPictureHash &digest)
     129UInt calcCRC(const TComPicYuv& pic, TComPictureHash &digest, const BitDepths &bitDepths)
    130130{
    131131  UInt digestLen=0;
     
    134134  {
    135135    const ComponentID compID=ComponentID(chan);
    136     digestLen=compCRC(g_bitDepth[toChannelType(compID)], pic.getAddr(compID), pic.getWidth(compID), pic.getHeight(compID), pic.getStride(compID), digest);
     136    digestLen=compCRC(bitDepths.recon[toChannelType(compID)], pic.getAddr(compID), pic.getWidth(compID), pic.getHeight(compID), pic.getStride(compID), digest);
    137137  }
    138138  return digestLen;
    139139}
    140140
    141 UInt compChecksum(Int bitdepth, const Pel* plane, UInt width, UInt height, UInt stride, TComPictureHash &digest)
     141UInt compChecksum(Int bitdepth, const Pel* plane, UInt width, UInt height, UInt stride, TComPictureHash &digest, const BitDepths &/*bitDepths*/)
    142142{
    143143  UInt checksum = 0;
     
    165165}
    166166
    167 UInt calcChecksum(const TComPicYuv& pic, TComPictureHash &digest)
     167UInt calcChecksum(const TComPicYuv& pic, TComPictureHash &digest, const BitDepths &bitDepths)
    168168{
    169169  UInt digestLen=0;
     
    172172  {
    173173    const ComponentID compID=ComponentID(chan);
    174     digestLen=compChecksum(g_bitDepth[toChannelType(compID)], pic.getAddr(compID), pic.getWidth(compID), pic.getHeight(compID), pic.getStride(compID), digest);
     174    digestLen=compChecksum(bitDepths.recon[toChannelType(compID)], pic.getAddr(compID), pic.getWidth(compID), pic.getHeight(compID), pic.getStride(compID), digest, bitDepths);
    175175  }
    176176  return digestLen;
     
    183183 * uses little-endian two byte words; 8bit data uses single byte words.
    184184 */
    185 UInt calcMD5(const TComPicYuv& pic, TComPictureHash &digest)
     185UInt calcMD5(const TComPicYuv& pic, TComPictureHash &digest, const BitDepths &bitDepths)
    186186{
    187187  /* choose an md5_plane packing function based on the system bitdepth */
     
    195195  {
    196196    const ComponentID compID=ComponentID(chan);
    197     md5_plane_func = g_bitDepth[toChannelType(compID)] <= 8 ? (MD5PlaneFunc)md5_plane<1> : (MD5PlaneFunc)md5_plane<2>;
     197    md5_plane_func = bitDepths.recon[toChannelType(compID)] <= 8 ? (MD5PlaneFunc)md5_plane<1> : (MD5PlaneFunc)md5_plane<2>;
    198198    UChar tmp_digest[MD5_DIGEST_STRING_LENGTH];
    199199    md5_plane_func(md5[compID], pic.getAddr(compID), pic.getWidth(compID), pic.getHeight(compID), pic.getStride(compID));
  • branches/SHM-dev/source/Lib/TLibCommon/TComPrediction.cpp

    r1262 r1287  
    480480      const UInt              uiAbsPartIdx      = rTu.GetAbsPartIdxTU();
    481481      const Bool              enableEdgeFilters = !(pcCU->isRDPCMEnabled(uiAbsPartIdx) && pcCU->getCUTransquantBypass(uiAbsPartIdx));
    482 
    483482#if O0043_BEST_EFFORT_DECODING
    484       xPredIntraAng( g_bitDepthInStream[channelType], ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, channelType, format, uiDirMode, bAbove, bLeft, enableEdgeFilters );
     483      const Int channelsBitDepthForPrediction = rTu.getCU()->getSlice()->getSPS()->getStreamBitDepth(channelType);
    485484#else
    486       xPredIntraAng( g_bitDepth[channelType], ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, channelType, format, uiDirMode, bAbove, bLeft, enableEdgeFilters );
     485#if SVC_EXTENSION
     486      const Int channelsBitDepthForPrediction = rTu.getCU()->getSlice()->getBitDepth(channelType);
     487#else
     488      const Int channelsBitDepthForPrediction = rTu.getCU()->getSlice()->getSPS()->getBitDepth(channelType);
    487489#endif
     490#endif
     491      xPredIntraAng( channelsBitDepthForPrediction, ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, channelType, format, uiDirMode, bAbove, bLeft, enableEdgeFilters );
    488492
    489493      if(( uiDirMode == DC_IDX ) && bAbove && bLeft )
     
    614618#endif
    615619
    616   for (UInt ch=COMPONENT_Y; ch<pcYuvPred->getNumberValidComponents(); ch++)
    617   {
    618     xPredInterBlk  (ComponentID(ch),  pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, pcYuvPred, bi );
     620  for (UInt comp=COMPONENT_Y; comp<pcYuvPred->getNumberValidComponents(); comp++)
     621  {
     622    const ComponentID compID=ComponentID(comp);
     623#if SVC_EXTENSION
     624    xPredInterBlk  (compID,  pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, pcYuvPred, bi, pcCU->getSlice()->getBitDepth(toChannelType(compID)) );
     625#else
     626    xPredInterBlk  (compID,  pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, pcYuvPred, bi, pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)) );
     627#endif
    619628  }
    620629}
     
    666675  else
    667676  {
    668     xWeightedAverage( &m_acYuvPred[REF_PIC_LIST_0], &m_acYuvPred[REF_PIC_LIST_1], iRefIdx[REF_PIC_LIST_0], iRefIdx[REF_PIC_LIST_1], uiPartAddr, iWidth, iHeight, pcYuvPred );
     677#if SVC_EXTENSION
     678    xWeightedAverage( &m_acYuvPred[REF_PIC_LIST_0], &m_acYuvPred[REF_PIC_LIST_1], iRefIdx[REF_PIC_LIST_0], iRefIdx[REF_PIC_LIST_1], uiPartAddr, iWidth, iHeight, pcYuvPred, pcCU->getSlice()->getBitDepths() );
     679#else
     680    xWeightedAverage( &m_acYuvPred[REF_PIC_LIST_0], &m_acYuvPred[REF_PIC_LIST_1], iRefIdx[REF_PIC_LIST_0], iRefIdx[REF_PIC_LIST_1], uiPartAddr, iWidth, iHeight, pcYuvPred, pcCU->getSlice()->getSPS()->getBitDepths() );
     681#endif
    669682  }
    670683}
     
    685698
    686699
    687 Void TComPrediction::xPredInterBlk(const ComponentID compID, TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *dstPic, Bool bi )
     700Void TComPrediction::xPredInterBlk(const ComponentID compID, TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *dstPic, Bool bi, const Int bitDepth )
    688701{
    689702  Int     refStride  = refPic->getStride(compID);
     
    707720  if ( yFrac == 0 )
    708721  {
    709     m_if.filterHor(compID, ref, refStride, dst,  dstStride, cxWidth, cxHeight, xFrac, !bi, chFmt);
     722    m_if.filterHor(compID, ref, refStride, dst,  dstStride, cxWidth, cxHeight, xFrac, !bi, chFmt, bitDepth);
    710723  }
    711724  else if ( xFrac == 0 )
    712725  {
    713     m_if.filterVer(compID, ref, refStride, dst, dstStride, cxWidth, cxHeight, yFrac, true, !bi, chFmt);
     726    m_if.filterVer(compID, ref, refStride, dst, dstStride, cxWidth, cxHeight, yFrac, true, !bi, chFmt, bitDepth);
    714727  }
    715728  else
     
    720733    const Int vFilterSize = isLuma(compID) ? NTAPS_LUMA : NTAPS_CHROMA;
    721734
    722     m_if.filterHor(compID, ref - ((vFilterSize>>1) -1)*refStride, refStride, tmp, tmpStride, cxWidth, cxHeight+vFilterSize-1, xFrac, false,      chFmt);
    723     m_if.filterVer(compID, tmp + ((vFilterSize>>1) -1)*tmpStride, tmpStride, dst, dstStride, cxWidth, cxHeight,               yFrac, false, !bi, chFmt);
    724   }
    725 }
    726 
    727 Void TComPrediction::xWeightedAverage( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv* pcYuvDst )
     735    m_if.filterHor(compID, ref - ((vFilterSize>>1) -1)*refStride, refStride, tmp, tmpStride, cxWidth, cxHeight+vFilterSize-1, xFrac, false,      chFmt, bitDepth);
     736    m_if.filterVer(compID, tmp + ((vFilterSize>>1) -1)*tmpStride, tmpStride, dst, dstStride, cxWidth, cxHeight,               yFrac, false, !bi, chFmt, bitDepth);
     737  }
     738}
     739
     740Void TComPrediction::xWeightedAverage( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv* pcYuvDst, const BitDepths &clipBitDepths )
    728741{
    729742  if( iRefIdx0 >= 0 && iRefIdx1 >= 0 )
    730743  {
    731     pcYuvDst->addAvg( pcYuvSrc0, pcYuvSrc1, uiPartIdx, iWidth, iHeight );
     744    pcYuvDst->addAvg( pcYuvSrc0, pcYuvSrc1, uiPartIdx, iWidth, iHeight, clipBitDepths );
    732745  }
    733746  else if ( iRefIdx0 >= 0 && iRefIdx1 <  0 )
     
    870883
    871884#if SVC_EXTENSION
    872 Void TComPrediction::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic )
    873 {
    874   m_cUsf.upsampleBasePic( currSlice, refLayerIdc, pcUsPic, pcBasePic, pcTempPic );
     885Void TComPrediction::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Int refBitDepthLuma, const Int refBitDepthChroma )
     886{
     887  m_cUsf.upsampleBasePic( currSlice, refLayerIdc, pcUsPic, pcBasePic, pcTempPic, refBitDepthLuma, refBitDepthChroma );
    875888}
    876889#endif //SVC_EXTENSION
  • branches/SHM-dev/source/Lib/TLibCommon/TComPrediction.h

    r1262 r1287  
    9494  Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv* pcYuvPred, Bool bi=false          );
    9595  Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight,                         TComYuv* pcYuvPred          );
    96   Void xPredInterBlk(const ComponentID compID, TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *dstPic, Bool bi );
    97   Void xWeightedAverage         ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv* pcYuvDst );
     96  Void xPredInterBlk(const ComponentID compID, TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *dstPic, Bool bi, const Int bitDepth );
     97  Void xWeightedAverage         ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv* pcYuvDst, const BitDepths &clipBitDepths );
    9898
    9999  Void xGetLLSPrediction ( const Pel* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0, const ChromaFormat chFmt  DEBUG_STRING_FN_DECLARE(sDebug) );
     
    145145
    146146#if SVC_EXTENSION
    147 Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic );
    148 #endif //SVC_EXTENSION
     147  Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Int refBitDepthLuma, const Int refBitDepthChroma );
     148#endif
    149149};
    150150
  • branches/SHM-dev/source/Lib/TLibCommon/TComRdCost.cpp

    r1259 r1287  
    192192}
    193193
    194 Void TComRdCost::setLambda( Double dLambda )
     194Void TComRdCost::setLambda( Double dLambda, const BitDepths &bitDepths )
    195195{
    196196  m_dLambda           = dLambda;
     
    202202  dLambda = 0.57 * pow(2.0, ((LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME - 12) / 3.0));
    203203#else
    204   dLambda = 0.57 * pow(2.0, ((LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME - 12 - 6 * (g_bitDepth[CHANNEL_TYPE_LUMA] - 8)) / 3.0));
     204  dLambda = 0.57 * pow(2.0, ((LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME - 12 - 6 * (bitDepths.recon[CHANNEL_TYPE_LUMA] - 8)) / 3.0));
    205205#endif
    206206  m_dLambdaMotionSAD[1] = 65536.0 * sqrt(dLambda);
     
    212212  dLambda = 0.57 * pow(2.0, ((LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME - 12) / 3.0));
    213213#else
    214   dLambda = 0.57 * pow(2.0, ((LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME - 12 - 6 * (g_bitDepth[CHANNEL_TYPE_LUMA] - 8)) / 3.0));
     214  dLambda = 0.57 * pow(2.0, ((LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME - 12 - 6 * (bitDepths.recon[CHANNEL_TYPE_LUMA] - 8)) / 3.0));
    215215#endif
    216216  m_uiLambdaMotionSAD[1] = (UInt)floor(65536.0 * sqrt(dLambda));
     
    340340Void TComRdCost::setDistParam( TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME )
    341341{
    342 #if SVC_EXTENSION
    343   // Set bit depth for weighted cost calculation
    344   rcDistParam.bitDepth = g_bitDepth[CHANNEL_TYPE_LUMA];
    345 #endif
    346342  // set Original & Curr Pointer / Stride
    347343  rcDistParam.pOrg = pcPatternKey->getROIY();
  • branches/SHM-dev/source/Lib/TLibCommon/TComRdCost.h

    r1259 r1287  
    138138
    139139  Void    setDistortionWeight  ( const ComponentID compID, const Double distortionWeight ) { m_distortionWeight[compID] = distortionWeight; }
    140   Void    setLambda      ( Double dLambda );
     140  Void    setLambda      ( Double dLambda, const BitDepths &bitDepths );
    141141  Void    setFrameLambda ( Double dLambda ) { m_dFrameLambda = dLambda; }
    142142
  • branches/SHM-dev/source/Lib/TLibCommon/TComRom.cpp

    r1285 r1287  
    541541
    542542// ====================================================================================================================
    543 // Bit-depth
    544 // ====================================================================================================================
    545 
    546 Int g_bitDepth   [MAX_NUM_CHANNEL_TYPE] = {8, 8};
    547 #if O0043_BEST_EFFORT_DECODING
    548 Int g_bitDepthInStream   [MAX_NUM_CHANNEL_TYPE] = {8, 8}; // In the encoder, this is the same as g_bitDepth. In the decoder, this can vary from g_bitDepth if the decoder is forced to use 'best-effort decoding' at a particular bit-depth.
    549 #endif
    550 
    551 // ====================================================================================================================
    552543// Misc.
    553544// ====================================================================================================================
     
    681672UInt g_predefSetIntraModes[NUM_INTRA_MODE-1] = {26,10,18,34,2,22,14,30,6,24,12,28,8,20,16,32,4,17,19,15,21,13,23,11,25,9,27,7,29,5,31,3,33,0,2};
    682673#endif
    683 Int  g_bitDepthLayer[MAX_NUM_CHANNEL_TYPE][MAX_LAYERS];
    684 void * g_refWeightACDCParam; // type=wpACDCParam
    685674Int g_mvScalingFactor  [MAX_LAYERS][2] = {{0,0}, {0,0}};
    686675Int g_posScalingFactor [MAX_LAYERS][2] = {{0,0}, {0,0}};
  • branches/SHM-dev/source/Lib/TLibCommon/TComRom.h

    r1285 r1287  
    153153
    154154// ====================================================================================================================
    155 // Bit-depth
    156 // ====================================================================================================================
    157 
    158 extern        Int g_bitDepth   [MAX_NUM_CHANNEL_TYPE];
    159 #if O0043_BEST_EFFORT_DECODING
    160 extern        Int g_bitDepthInStream   [MAX_NUM_CHANNEL_TYPE]; // In the encoder, this is the same as g_bitDepth. In the decoder, this can vary from g_bitDepth if the decoder is forced to use 'best-effort decoding' at a particular bit-depth.
    161 #endif
    162 
    163 // ====================================================================================================================
    164155// Mode-Dependent DST Matrices
    165156// ====================================================================================================================
  • branches/SHM-dev/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp

    r1260 r1287  
    4444//! \ingroup TLibCommon
    4545//! \{
    46 #if !SVC_EXTENSION
    47 UInt g_saoMaxOffsetQVal[MAX_NUM_COMPONENT];
    48 #endif
    4946
    5047SAOOffset::SAOOffset()
     
    154151  for(Int compIdx = 0; compIdx < MAX_NUM_COMPONENT; compIdx++)
    155152  {
    156     Int bitDepthSample = g_bitDepth[toChannelType(ComponentID(compIdx))];
    157153    m_offsetStepLog2  [compIdx] = isLuma(ComponentID(compIdx))? lumaBitShift : chromaBitShift;
    158 #if SVC_EXTENSION
    159     m_saoMaxOffsetQVal[compIdx] = (1<<(min(bitDepthSample,MAX_SAO_TRUNCATED_BITDEPTH)-5))-1; //Table 9-32, inclusive
    160 #else
    161     g_saoMaxOffsetQVal[compIdx] = (1<<(min(bitDepthSample,MAX_SAO_TRUNCATED_BITDEPTH)-5))-1; //Table 9-32, inclusive
    162 #endif
    163154  }
    164155}
     
    320311
    321312
    322 Void TComSampleAdaptiveOffset::offsetBlock(ComponentID compIdx, Int typeIdx, Int* offset
     313Void TComSampleAdaptiveOffset::offsetBlock(const Int channelBitDepth, Int typeIdx, Int* offset
    323314                                          , Pel* srcBlk, Pel* resBlk, Int srcStride, Int resStride,  Int width, Int height
    324315                                          , Bool isLeftAvail,  Bool isRightAvail, Bool isAboveAvail, Bool isBelowAvail, Bool isAboveLeftAvail, Bool isAboveRightAvail, Bool isBelowLeftAvail, Bool isBelowRightAvail)
     
    343334  }
    344335
    345   const Int maxSampleValueIncl = (1<< g_bitDepth[toChannelType(compIdx)] )-1;
     336  const Int maxSampleValueIncl = (1<< channelBitDepth )-1;
    346337
    347338  Int x,y, startX, startY, endX, endY, edgeType;
     
    540531  case SAO_TYPE_BO:
    541532    {
    542       const Int shiftBits = g_bitDepth[toChannelType(compIdx)] - NUM_SAO_BO_CLASSES_LOG2;
     533      const Int shiftBits = channelBitDepth - NUM_SAO_BO_CLASSES_LOG2;
    543534      for (y=0; y< height; y++)
    544535      {
     
    608599      Pel* resBlk     = resYuv->getAddr(component) + blkYPos*resStride + blkXPos;
    609600
    610       offsetBlock( component, ctbOffset.typeIdc, ctbOffset.offset
     601#if SVC_EXTENSION
     602      offsetBlock( pPic->getSlice(0)->getBitDepth(toChannelType(component)), ctbOffset.typeIdc, ctbOffset.offset
     603#else
     604      offsetBlock( pPic->getPicSym()->getSPS().getBitDepth(toChannelType(component)), ctbOffset.typeIdc, ctbOffset.offset
     605#endif
    611606                  , srcBlk, resBlk, srcStride, resStride, blkWidth, blkHeight
    612607                  , isLeftAvail, isRightAvail
     
    743738  else
    744739  {
    745     uiPcmLeftShiftBit = g_bitDepth[toChannelType(compID)] - pcCU->getSlice()->getSPS()->getPCMBitDepth(toChannelType(compID));
     740#if SVC_EXTENSION
     741    uiPcmLeftShiftBit = pcCU->getSlice()->getBitDepth(toChannelType(compID)) - pcCU->getSlice()->getSPS()->getPCMBitDepth(toChannelType(compID));
     742#else
     743    uiPcmLeftShiftBit = pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)) - pcCU->getSlice()->getSPS()->getPCMBitDepth(toChannelType(compID));
     744#endif
    746745  }
    747746
  • branches/SHM-dev/source/Lib/TLibCommon/TComSampleAdaptiveOffset.h

    r1260 r1287  
    5555// Class definition
    5656// ====================================================================================================================
    57 #if !SVC_EXTENSION
    58 extern UInt g_saoMaxOffsetQVal[MAX_NUM_COMPONENT];
    59 #endif
    6057
    6158template <typename T> Int sgn(T val)
     
    7471  Void reconstructBlkSAOParams(TComPic* pic, SAOBlkParam* saoBlkParams);
    7572  Void PCMLFDisableProcess (TComPic* pcPic);
    76 #if SVC_EXTENSION
    77   UInt* getSaoMaxOffsetQVal() { return m_saoMaxOffsetQVal; }
    78 #endif
     73  static Int getMaxOffsetQVal(const Int channelBitDepth) { return (1<<(std::min<Int>(channelBitDepth,MAX_SAO_TRUNCATED_BITDEPTH)-5))-1; } //Table 9-32, inclusive
     74
    7975protected:
    80   Void offsetBlock(ComponentID compIdx, Int typeIdx, Int* offset, Pel* srcBlk, Pel* resBlk, Int srcStride, Int resStride,  Int width, Int height
     76  Void offsetBlock(const Int channelBitDepth, Int typeIdx, Int* offset, Pel* srcBlk, Pel* resBlk, Int srcStride, Int resStride,  Int width, Int height
    8177                  , Bool isLeftAvail, Bool isRightAvail, Bool isAboveAvail, Bool isBelowAvail, Bool isAboveLeftAvail, Bool isAboveRightAvail, Bool isBelowLeftAvail, Bool isBelowRightAvail);
    8278  Void invertQuantOffsets(ComponentID compIdx, Int typeIdc, Int typeAuxInfo, Int* dstOffsets, Int* srcOffsets);
     
    105101private:
    106102  Bool m_picSAOEnabled[MAX_NUM_COMPONENT];
    107 
    108 #if SVC_EXTENSION
    109   UInt m_saoMaxOffsetQVal[MAX_NUM_COMPONENT];
    110 #endif
    111103};
    112104
  • branches/SHM-dev/source/Lib/TLibCommon/TComSlice.cpp

    r1273 r1287  
    512512                            );
    513513
    514         Bool sameBitDepths = ( g_bitDepthLayer[CHANNEL_TYPE_LUMA][m_layerId] == g_bitDepthLayer[CHANNEL_TYPE_LUMA][refLayerId] ) && ( g_bitDepthLayer[CHANNEL_TYPE_CHROMA][m_layerId] == g_bitDepthLayer[CHANNEL_TYPE_CHROMA][refLayerId] );
     514        Bool sameBitDepths = ( getBitDepth(CHANNEL_TYPE_LUMA) == ilpPic[refLayerIdc]->getSlice(0)->getBitDepth(CHANNEL_TYPE_LUMA) ) && ( getBitDepth(CHANNEL_TYPE_CHROMA) == ilpPic[refLayerIdc]->getSlice(0)->getBitDepth(CHANNEL_TYPE_CHROMA) );
    515515
    516516        // motion resampling constraint
     
    18211821}
    18221822
    1823 //! get AC and DC values for weighted pred
    1824 Void  TComSlice::getWpAcDcParam(WPACDCParam *&wp)
    1825 {
    1826   wp = m_weightACDCParam;
    1827 }
    1828 
    18291823//! init AC and DC values for weighted pred
    18301824Void  TComSlice::initWpAcDcParam()
     
    18821876        }
    18831877
    1884         const Int offsetScalingFactor = bUseHighPrecisionPredictionWeighting ? 1 : (1 << (g_bitDepth[toChannelType(ComponentID(yuv))]-8));
     1878#if SVC_EXTENSION
     1879        const Int offsetScalingFactor = bUseHighPrecisionPredictionWeighting ? 1 : (1 << (getBitDepth(toChannelType(ComponentID(yuv)))-8));
     1880#else
     1881        const Int offsetScalingFactor = bUseHighPrecisionPredictionWeighting ? 1 : (1 << (sps->getBitDepth(toChannelType(ComponentID(yuv)))-8));
     1882#endif
    18851883
    18861884        pwp->w      = pwp->iWeight;
     
    20982096  for(Int ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++)
    20992097  {
    2100     m_uiBitDepth   [ch] = 8;
    2101     m_uiPCMBitDepth[ch] = 8;
     2098    m_bitDepths.recon[ch] = 8;
     2099#if O0043_BEST_EFFORT_DECODING
     2100    m_bitDepths.stream[ch] = 8;
     2101#endif
     2102    m_pcmBitDepths[ch] = 8;
    21022103    m_qpBDOffset   [ch] = 0;
    21032104  }
     
    35603561}
    35613562
    3562 UInt TComSlice::getBitDepthY()
     3563BitDepths& TComSlice::getBitDepths()
     3564{
     3565  static BitDepths bitDepths;
     3566
     3567  bitDepths.recon[CHANNEL_TYPE_LUMA] = getBitDepth(CHANNEL_TYPE_LUMA);
     3568  bitDepths.recon[CHANNEL_TYPE_CHROMA] = getBitDepth(CHANNEL_TYPE_CHROMA);
     3569
     3570  return bitDepths;
     3571}
     3572
     3573UInt TComSlice::getBitDepth(ChannelType type) const
    35633574{
    35643575  UInt retVal, layerId = getLayerId();
     
    35683579    if( layerId == 0 && m_pcVPS->getNonHEVCBaseLayerFlag() )
    35693580    {
    3570       retVal = m_pcVPS->getVpsRepFormat(layerId)->getBitDepthVpsLuma();
     3581      retVal = m_pcVPS->getVpsRepFormat(layerId)->getBitDepthVps(type);
    35713582    }
    35723583    else
    35733584    {
    3574       retVal = m_pcSPS->getBitDepth(CHANNEL_TYPE_LUMA);
     3585      retVal = m_pcSPS->getBitDepth(type);
    35753586    }
    35763587  }
    35773588  else
    35783589  {
    3579     retVal = m_pcVPS->getVpsRepFormat(m_pcSPS->getUpdateRepFormatFlag() ? m_pcSPS->getUpdateRepFormatIndex() : m_pcVPS->getVpsRepFormatIdx(m_pcVPS->getLayerIdxInVps(layerId)))->getBitDepthVpsLuma();
     3590    retVal = m_pcVPS->getVpsRepFormat(m_pcSPS->getUpdateRepFormatFlag() ? m_pcSPS->getUpdateRepFormatIndex() : m_pcVPS->getVpsRepFormatIdx(m_pcVPS->getLayerIdxInVps(layerId)))->getBitDepthVps(type);
    35803591  }
    35813592
     
    35833594}
    35843595
    3585 UInt TComVPS::getBitDepthY( const TComSPS* sps, const UInt layerId ) const
     3596UInt TComVPS::getBitDepth( ChannelType type, const TComSPS* sps, const UInt layerId ) const
    35863597{
    35873598  UInt retVal;
     
    35913602    if( layerId == 0 && m_nonHEVCBaseLayerFlag )
    35923603    {
    3593       retVal = m_vpsRepFormat[layerId].getBitDepthVpsLuma();
     3604      retVal = m_vpsRepFormat[layerId].getBitDepthVps(type);
    35943605    }
    35953606    else
    35963607    {
    3597       retVal = sps->getBitDepth(CHANNEL_TYPE_LUMA);
     3608      retVal = sps->getBitDepth(type);
    35983609    }
    35993610  }
    36003611  else
    36013612  {
    3602     retVal = m_vpsRepFormat[sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : m_vpsRepFormatIdx[m_layerIdxInVps[layerId]]].getBitDepthVpsLuma();
     3613    retVal = m_vpsRepFormat[sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : m_vpsRepFormatIdx[m_layerIdxInVps[layerId]]].getBitDepthVps(type);
    36033614  }
    36043615
     
    36063617}
    36073618
    3608 UInt TComSlice::getBitDepthC()
    3609 {
    3610   UInt retVal, layerId = getLayerId();
    3611 
    3612   if( layerId == 0 || m_pcSPS->getV1CompatibleSPSFlag() == 1 )
    3613   {
    3614     if( layerId == 0 && m_pcVPS->getNonHEVCBaseLayerFlag() )
    3615     {
    3616       retVal = m_pcVPS->getVpsRepFormat(layerId)->getBitDepthVpsChroma();
    3617     }
    3618     else
    3619     {
    3620       retVal = m_pcSPS->getBitDepth(CHANNEL_TYPE_CHROMA);
    3621     }
    3622   }
    3623   else
    3624   {
    3625     retVal = m_pcVPS->getVpsRepFormat(m_pcSPS->getUpdateRepFormatFlag() ? m_pcSPS->getUpdateRepFormatIndex() : m_pcVPS->getVpsRepFormatIdx(m_pcVPS->getLayerIdxInVps(layerId)))->getBitDepthVpsChroma();
    3626   }
    3627 
    3628   return retVal;
    3629 }
    3630 
    3631 UInt TComVPS::getBitDepthC( const TComSPS* sps, const UInt layerId ) const
    3632 {
    3633   UInt retVal;
    3634 
    3635   if( layerId == 0 || sps->getV1CompatibleSPSFlag() == 1 )
    3636   {
    3637     if( layerId == 0 && m_nonHEVCBaseLayerFlag )
    3638     {
    3639       retVal = m_vpsRepFormat[layerId].getBitDepthVpsChroma();
    3640     }
    3641     else
    3642     {
    3643       retVal = sps->getBitDepth(CHANNEL_TYPE_CHROMA);
    3644     }
    3645   }
    3646   else
    3647   {
    3648     retVal = m_vpsRepFormat[sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : m_vpsRepFormatIdx[m_layerIdxInVps[layerId]]].getBitDepthVpsChroma();
    3649   }
    3650 
    3651   return retVal;
    3652 }
    3653 
    3654 Int TComSlice::getQpBDOffsetY()
    3655 {
    3656   return (getBitDepthY() - 8) * 6;
    3657 }
    3658 
    3659 Int TComSlice::getQpBDOffsetC()
    3660 {
    3661   return (getBitDepthC() - 8) * 6;
     3619const BitDepths& TComVPS::getBitDepths( const TComSPS* sps, const UInt layerId ) const
     3620{
     3621  static const BitDepths bitDepths( getBitDepth(CHANNEL_TYPE_LUMA, sps, layerId), getBitDepth(CHANNEL_TYPE_CHROMA, sps, layerId) );
     3622  return bitDepths;
    36623623}
    36633624
     
    37833744      pcIlpPic[refLayerIdc]->getSlice(0)->setPPS( m_pcPic->getSlice(0)->getPPS() );
    37843745
     3746      // assign SPS to ILRP to be used for obtaining bit depth
     3747      pcIlpPic[refLayerIdc]->getSlice(0)->setSPS( m_pcPic->getSlice(0)->getSPS() );
     3748
    37853749      // assing VPS to ILRP to be used for deriving layerIdx
    37863750      pcIlpPic[refLayerIdc]->getSlice(0)->setVPS( m_pcPic->getSlice(0)->getVPS() );
  • branches/SHM-dev/source/Lib/TLibCommon/TComSlice.h

    r1285 r1287  
    563563  Void setBitDepthVpsChroma(Int x)                            { m_bitDepthVpsChroma = x;                                         }
    564564
    565   Int  getBitDepthVps(ChannelType type)                       { return isLuma(type) ? m_bitDepthVpsLuma : m_bitDepthVpsChroma;   }
     565  Int  getBitDepthVps(ChannelType type) const                 { return isLuma(type) ? m_bitDepthVpsLuma : m_bitDepthVpsChroma;   }
    566566
    567567  Window& getConformanceWindowVps()                           { return m_conformanceWindowVps;                                   }
     
    11291129  UInt              getPicHeightInLumaSamples( const TComSPS* sps, const UInt layerId ) const;
    11301130  UInt              getPicWidthInLumaSamples( const TComSPS* sps, const UInt layerId ) const;
    1131   UInt              getBitDepthY( const TComSPS* sps, const UInt layerId ) const;
    1132   UInt              getBitDepthC( const TComSPS* sps, const UInt layerId ) const;
     1131  UInt              getBitDepth( ChannelType type, const TComSPS* sps, const UInt layerId ) const;
     1132  const BitDepths&  getBitDepths( const TComSPS* sps, const UInt layerId ) const;
    11331133  const Window&     getConformanceWindow( const TComSPS* sps, const UInt layerId ) const;
    11341134#endif //SVC_EXTENSION
     
    13041304};
    13051305
     1306
    13061307/// SPS class
    13071308class TComSPS
     
    13421343
    13431344  // Parameter
    1344   Int              m_uiBitDepth[MAX_NUM_CHANNEL_TYPE];
     1345  BitDepths        m_bitDepths;
    13451346  Int              m_qpBDOffset[MAX_NUM_CHANNEL_TYPE];
    13461347  Bool             m_useExtendedPrecision;
     
    13511352  Bool             m_alignCABACBeforeBypass;
    13521353  Bool             m_useResidualDPCM[NUMBER_OF_RDPCM_SIGNALLING_MODES];
    1353   UInt             m_uiPCMBitDepth[MAX_NUM_CHANNEL_TYPE];
     1354  Int              m_pcmBitDepths[MAX_NUM_CHANNEL_TYPE];
    13541355  Bool             m_bPCMFilterDisableFlag;
    13551356  Bool             m_disableIntraReferenceSmoothing;
     
    14781479
    14791480  // Bit-depth
    1480   Int                    getBitDepth(ChannelType type) const                                             { return m_uiBitDepth[type];                                           }
    1481   Void                   setBitDepth(ChannelType type, Int u )                                           { m_uiBitDepth[type] = u;                                              }
    1482   Int                    getMaxLog2TrDynamicRange(ChannelType channelType) const                         { return getUseExtendedPrecision() ? std::max<Int>(15, Int(m_uiBitDepth[channelType] + 6)) : 15; }
    1483 
    1484   Int                    getDifferentialLumaChromaBitDepth() const                                       { return Int(m_uiBitDepth[CHANNEL_TYPE_LUMA]) - Int(m_uiBitDepth[CHANNEL_TYPE_CHROMA]); }
     1481  Int                    getBitDepth(ChannelType type) const                                             { return m_bitDepths.recon[type];                                      }
     1482  Void                   setBitDepth(ChannelType type, Int u )                                           { m_bitDepths.recon[type] = u;                                         }
     1483#if O0043_BEST_EFFORT_DECODING
     1484  Int                    getStreamBitDepth(ChannelType type) const                                       { return m_bitDepths.stream[type];                                     }
     1485  Void                   setStreamBitDepth(ChannelType type, Int u )                                     { m_bitDepths.stream[type] = u;                                        }
     1486#endif
     1487  const BitDepths&       getBitDepths() const                                                            { return m_bitDepths;                                                  }
     1488  Int                    getMaxLog2TrDynamicRange(ChannelType channelType) const                         { return getUseExtendedPrecision() ? std::max<Int>(15, Int(m_bitDepths.recon[channelType] + 6)) : 15; }
     1489
     1490  Int                    getDifferentialLumaChromaBitDepth() const                                       { return Int(m_bitDepths.recon[CHANNEL_TYPE_LUMA]) - Int(m_bitDepths.recon[CHANNEL_TYPE_CHROMA]); }
    14851491  Int                    getQpBDOffset(ChannelType type) const                                           { return m_qpBDOffset[type];                                           }
    14861492  Void                   setQpBDOffset(ChannelType type, Int i)                                          { m_qpBDOffset[type] = i;                                              }
     
    15131519  Bool                   getTemporalIdNestingFlag() const                                                { return m_bTemporalIdNestingFlag;                                     }
    15141520  Void                   setTemporalIdNestingFlag( Bool bValue )                                         { m_bTemporalIdNestingFlag = bValue;                                   }
    1515   UInt                   getPCMBitDepth(ChannelType type) const                                          { return m_uiPCMBitDepth[type];                                        }
    1516   Void                   setPCMBitDepth(ChannelType type, UInt u)                                        { m_uiPCMBitDepth[type] = u;                                           }
     1521  UInt                   getPCMBitDepth(ChannelType type) const                                          { return m_pcmBitDepths[type];                                         }
     1522  Void                   setPCMBitDepth(ChannelType type, UInt u)                                        { m_pcmBitDepths[type] = u;                                            }
    15171523  Void                   setPCMFilterDisableFlag( Bool bValue )                                          { m_bPCMFilterDisableFlag = bValue;                                    }
    15181524  Bool                   getPCMFilterDisableFlag() const                                                 { return m_bPCMFilterDisableFlag;                                      }
     
    22602266  }
    22612267
    2262   Void                        getWpAcDcParam( WPACDCParam *&wp );
     2268  WPACDCParam*                getWpAcDcParam()                                       { return &m_weightACDCParam[0]; }
     2269
    22632270  Void                        initWpAcDcParam();
    22642271
     
    22932300
    22942301  Void                        setLayerId(UInt layerId)                               { m_layerId = layerId;                                          }
    2295   UInt                        getLayerId()                                           { return m_layerId;                                             }
     2302  UInt                        getLayerId() const                                     { return m_layerId;                                             }
    22962303  UInt                        getLayerIdx()                                          { return m_pcVPS->getLayerIdxInVps(m_layerId);                  }
    22972304
     
    23472354  UInt                        getPicHeightInLumaSamples();
    23482355  ChromaFormat                getChromaFormatIdc();
    2349   UInt                        getBitDepthY();
    2350   UInt                        getBitDepthC();
    2351   Int                         getQpBDOffsetY();
    2352   Int                         getQpBDOffsetC();
     2356  UInt                        getBitDepth(ChannelType type) const;
     2357  BitDepths&                  getBitDepths();
     2358  Int                         getQpBDOffset(ChannelType type) const                  { return (getBitDepth(type) - 8) * 6;                           }
    23532359
    23542360  const Window&               getConformanceWindow() const;
  • branches/SHM-dev/source/Lib/TLibCommon/TComTrQuant.cpp

    r1285 r1287  
    119119                  toChannelType(compID),
    120120#if SVC_EXTENSION
    121                   isLuma(compID) ? slice->getQpBDOffsetY() : slice->getQpBDOffsetC(),
     121                  cu.getSlice()->getQpBDOffset(toChannelType(compID)),
    122122#else
    123123                  cu.getSlice()->getSPS()->getQpBDOffset(toChannelType(compID)),
     
    11471147  TComDataCU* pcCU          = rTu.getCU();
    11481148  const UInt uiAbsPartIdx   = rTu.GetAbsPartIdxTU();
     1149#if SVC_EXTENSION
     1150  const Int channelBitDepth = pcCU->getSlice()->getBitDepth(toChannelType(compID));
     1151#else
     1152  const Int channelBitDepth = pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID));
     1153#endif
    11491154
    11501155  TCoeff* piCoef    = pSrc;
     
    11921197
    11931198    // Represents scaling through forward transform
    1194     Int iTransformShift = getTransformShift(toChannelType(compID), uiLog2TrSize, maxLog2TrDynamicRange);
     1199    Int iTransformShift = getTransformShift(channelBitDepth, uiLog2TrSize, maxLog2TrDynamicRange);
    11951200    if (useTransformSkip && pcCU->getSlice()->getSPS()->getUseExtendedPrecision())
    11961201    {
     
    12711276  const Bool                 enableScalingLists = getUseScalingList(uiWidth, uiHeight, (pcCU->getTransformSkip(uiAbsPartIdx, compID) != 0));
    12721277  const Int                  scalingListType    = getScalingListType(pcCU->getPredictionMode(uiAbsPartIdx), compID);
     1278#if O0043_BEST_EFFORT_DECODING
     1279  const Int                  channelBitDepth    = pcCU->getSlice()->getSPS()->getStreamBitDepth(toChannelType(compID));
     1280#else
     1281#if SVC_EXTENSION
     1282  const Int                  channelBitDepth    = pcCU->getSlice()->getBitDepth(toChannelType(compID));
     1283#else
     1284  const Int                  channelBitDepth    = pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID));
     1285#endif
     1286#endif
    12731287
    12741288  assert (scalingListType < SCALING_LIST_NUM);
     
    12771291  // Represents scaling through forward transform
    12781292  const Bool bClipTransformShiftTo0 = (pcCU->getTransformSkip(uiAbsPartIdx, compID) != 0) && pcCU->getSlice()->getSPS()->getUseExtendedPrecision();
    1279   const Int  originalTransformShift = getTransformShift(toChannelType(compID), uiLog2TrSize, maxLog2TrDynamicRange);
     1293  const Int  originalTransformShift = getTransformShift(channelBitDepth, uiLog2TrSize, maxLog2TrDynamicRange);
    12801294  const Int  iTransformShift        = bClipTransformShiftTo0 ? std::max<Int>(0, originalTransformShift) : originalTransformShift;
    12811295
     
    14431457      else
    14441458      {
    1445         xT( compID, rTu.useDST(compID), pcResidual, uiStride, m_plTempCoeff, uiWidth, uiHeight, pcCU->getSlice()->getSPS()->getMaxLog2TrDynamicRange(toChannelType(compID)) );
     1459#if SVC_EXTENSION
     1460        const Int channelBitDepth=pcCU->getSlice()->getBitDepth(toChannelType(compID));
     1461#else
     1462        const Int channelBitDepth=pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID));
     1463#endif
     1464        xT( channelBitDepth, rTu.useDST(compID), pcResidual, uiStride, m_plTempCoeff, uiWidth, uiHeight, pcCU->getSlice()->getSPS()->getMaxLog2TrDynamicRange(toChannelType(compID)) );
    14461465      }
    14471466
     
    15731592    else
    15741593    {
    1575       xIT( compID, rTu.useDST(compID), m_plTempCoeff, pcResidual, uiStride, uiWidth, uiHeight, pcCU->getSlice()->getSPS()->getMaxLog2TrDynamicRange(toChannelType(compID)) );
     1594#if O0043_BEST_EFFORT_DECODING
     1595      const Int channelBitDepth = pcCU->getSlice()->getSPS()->getStreamBitDepth(toChannelType(compID));
     1596#else
     1597#if SVC_EXTENSION
     1598      const Int channelBitDepth = pcCU->getSlice()->getBitDepth(toChannelType(compID));
     1599#else
     1600      const Int channelBitDepth = pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID));
     1601#endif
     1602#endif
     1603      xIT( channelBitDepth, rTu.useDST(compID), m_plTempCoeff, pcResidual, uiStride, uiWidth, uiHeight, pcCU->getSlice()->getSPS()->getMaxLog2TrDynamicRange(toChannelType(compID)) );
    15761604
    15771605#if defined DEBUG_STRING
     
    18651893 *  \param iHeight transform height
    18661894 */
    1867 Void TComTrQuant::xT( const ComponentID compID, Bool useDST, Pel* piBlkResi, UInt uiStride, TCoeff* psCoeff, Int iWidth, Int iHeight, const Int maxLog2TrDynamicRange )
     1895Void TComTrQuant::xT( const Int channelBitDepth, Bool useDST, Pel* piBlkResi, UInt uiStride, TCoeff* psCoeff, Int iWidth, Int iHeight, const Int maxLog2TrDynamicRange )
    18681896{
    18691897#if MATRIX_MULT
    18701898  if( iWidth == iHeight)
    18711899  {
    1872     xTr(g_bitDepth[toChannelType(compID)], piBlkResi, psCoeff, uiStride, (UInt)iWidth, useDST, maxLog2TrDynamicRange);
     1900    xTr(channelBitDepth, piBlkResi, psCoeff, uiStride, (UInt)iWidth, useDST, maxLog2TrDynamicRange);
    18731901    return;
    18741902  }
     
    18861914  }
    18871915
    1888   xTrMxN( g_bitDepth[toChannelType(compID)], block, coeff, iWidth, iHeight, useDST, maxLog2TrDynamicRange );
     1916  xTrMxN( channelBitDepth, block, coeff, iWidth, iHeight, useDST, maxLog2TrDynamicRange );
    18891917
    18901918  memcpy(psCoeff, coeff, (iWidth * iHeight * sizeof(TCoeff)));
     
    19001928 *  \param iHeight transform height
    19011929 */
    1902 Void TComTrQuant::xIT( const ComponentID compID, Bool useDST, TCoeff* plCoef, Pel* pResidual, UInt uiStride, Int iWidth, Int iHeight, const Int maxLog2TrDynamicRange )
     1930Void TComTrQuant::xIT( const Int channelBitDepth, Bool useDST, TCoeff* plCoef, Pel* pResidual, UInt uiStride, Int iWidth, Int iHeight, const Int maxLog2TrDynamicRange )
    19031931{
    19041932#if MATRIX_MULT
    19051933  if( iWidth == iHeight )
    19061934  {
    1907 #if O0043_BEST_EFFORT_DECODING
    1908     xITr(g_bitDepthInStream[toChannelType(compID)], plCoef, pResidual, uiStride, (UInt)iWidth, useDST, maxLog2TrDynamicRange);
    1909 #else
    1910     xITr(g_bitDepth[toChannelType(compID)], plCoef, pResidual, uiStride, (UInt)iWidth, useDST, maxLog2TrDynamicRange);
    1911 #endif
     1935    xITr(channelBitDepth, plCoef, pResidual, uiStride, (UInt)iWidth, useDST, maxLog2TrDynamicRange);
    19121936    return;
    19131937  }
     
    19191943  memcpy(coeff, plCoef, (iWidth * iHeight * sizeof(TCoeff)));
    19201944
    1921 #if O0043_BEST_EFFORT_DECODING
    1922   xITrMxN( g_bitDepthInStream[toChannelType(compID)], coeff, block, iWidth, iHeight, useDST, maxLog2TrDynamicRange );
    1923 #else
    1924   xITrMxN( g_bitDepth[toChannelType(compID)], coeff, block, iWidth, iHeight, useDST, maxLog2TrDynamicRange );
    1925 #endif
     1945  xITrMxN( channelBitDepth, coeff, block, iWidth, iHeight, useDST, maxLog2TrDynamicRange );
    19261946
    19271947  for (Int y = 0; y < iHeight; y++)
     
    19471967  const Int height          = rect.height;
    19481968  const Int maxLog2TrDynamicRange = rTu.getCU()->getSlice()->getSPS()->getMaxLog2TrDynamicRange(toChannelType(component));
    1949 
    1950   Int iTransformShift = getTransformShift(toChannelType(component), rTu.GetEquivalentLog2TrSize(component), maxLog2TrDynamicRange);
     1969#if SVC_EXTENSION
     1970  const Int channelBitDepth = rTu.getCU()->getSlice()->getBitDepth(toChannelType(component));
     1971#else
     1972  const Int channelBitDepth = rTu.getCU()->getSlice()->getSPS()->getBitDepth(toChannelType(component));
     1973#endif
     1974
     1975  Int iTransformShift = getTransformShift(channelBitDepth, rTu.GetEquivalentLog2TrSize(component), maxLog2TrDynamicRange);
    19511976  if (rTu.getCU()->getSlice()->getSPS()->getUseExtendedPrecision())
    19521977  {
     
    19952020  const Int height          = rect.height;
    19962021  const Int maxLog2TrDynamicRange = rTu.getCU()->getSlice()->getSPS()->getMaxLog2TrDynamicRange(toChannelType(component));
    1997 
    1998   Int iTransformShift = getTransformShift(toChannelType(component), rTu.GetEquivalentLog2TrSize(component), maxLog2TrDynamicRange);
     2022#if O0043_BEST_EFFORT_DECODING
     2023  const Int channelBitDepth = rTu.getCU()->getSlice()->getSPS()->getStreamBitDepth(toChannelType(component));
     2024#else
     2025#if SVC_EXTENSION
     2026  const Int channelBitDepth = rTu.getCU()->getSlice()->getBitDepth(toChannelType(component));
     2027#else
     2028  const Int channelBitDepth = rTu.getCU()->getSlice()->getSPS()->getBitDepth(toChannelType(component));
     2029#endif
     2030#endif
     2031
     2032  Int iTransformShift = getTransformShift(channelBitDepth, rTu.GetEquivalentLog2TrSize(component), maxLog2TrDynamicRange);
    19992033  if (rTu.getCU()->getSlice()->getSPS()->getUseExtendedPrecision())
    20002034  {
     
    20632097  const Bool             extendedPrecision = pcCU->getSlice()->getSPS()->getUseExtendedPrecision();
    20642098  const Int              maxLog2TrDynamicRange = pcCU->getSlice()->getSPS()->getMaxLog2TrDynamicRange(toChannelType(compID));
     2099#if SVC_EXTENSION
     2100  const Int              channelBitDepth = rTu.getCU()->getSlice()->getBitDepth(channelType);
     2101#else
     2102  const Int              channelBitDepth = rTu.getCU()->getSlice()->getSPS()->getBitDepth(channelType);
     2103#endif
    20652104
    20662105  /* for 422 chroma blocks, the effective scaling applied during transformation is not a power of 2, hence it cannot be
     
    20712110
    20722111  // Represents scaling through forward transform
    2073   Int iTransformShift            = getTransformShift(channelType, uiLog2TrSize, maxLog2TrDynamicRange);
     2112  Int iTransformShift = getTransformShift(channelBitDepth, uiLog2TrSize, maxLog2TrDynamicRange);
    20742113  if ((pcCU->getTransformSkip(uiAbsPartIdx, compID) != 0) && pcCU->getSlice()->getSPS()->getUseExtendedPrecision())
    20752114  {
     
    24572496    const Double inverseQuantScale = Double(g_invQuantScales[cQP.rem]);
    24582497    Int64 rdFactor = (Int64)(inverseQuantScale * inverseQuantScale * (1 << (2 * cQP.per))
    2459                              / m_dLambda / 16 / (1 << (2 * DISTORTION_PRECISION_ADJUSTMENT(g_bitDepth[channelType] - 8)))
     2498                             / m_dLambda / 16 / (1 << (2 * DISTORTION_PRECISION_ADJUSTMENT(channelBitDepth - 8)))
    24602499                             + 0.5);
    24612500
     
    29863025 * \param format      chroma format
    29873026 */
    2988 Void TComTrQuant::setScalingList(TComScalingList *scalingList, const ChromaFormat format, const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE])
     3027Void TComTrQuant::setScalingList(TComScalingList *scalingList, const ChromaFormat format, const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE], const BitDepths &bitDepths)
    29893028{
    29903029  const Int minimumQp = 0;
     
    29993038        xSetScalingListEnc(scalingList,list,size,qp,format);
    30003039        xSetScalingListDec(*scalingList,list,size,qp,format);
    3001         setErrScaleCoeff(list,size,qp,maxLog2TrDynamicRange);
     3040        setErrScaleCoeff(list,size,qp,maxLog2TrDynamicRange, bitDepths);
    30023041      }
    30033042    }
     
    30293068 * \param qp   Quantization parameter
    30303069 */
    3031 Void TComTrQuant::setErrScaleCoeff(UInt list, UInt size, Int qp, const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE])
     3070Void TComTrQuant::setErrScaleCoeff(UInt list, UInt size, Int qp, const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE], const BitDepths &bitDepths)
    30323071{
    30333072  const UInt uiLog2TrSize = g_aucConvertToBit[ g_scalingListSizeX[size] ] + 2;
    30343073  const ChannelType channelType = ((list == 0) || (list == MAX_NUM_COMPONENT)) ? CHANNEL_TYPE_LUMA : CHANNEL_TYPE_CHROMA;
    30353074
    3036   const Int iTransformShift = getTransformShift(channelType, uiLog2TrSize, maxLog2TrDynamicRange[channelType]);  // Represents scaling through forward transform
     3075  const Int channelBitDepth    = bitDepths.recon[channelType];
     3076  const Int iTransformShift = getTransformShift(channelBitDepth, uiLog2TrSize, maxLog2TrDynamicRange[channelType]);  // Represents scaling through forward transform
    30373077
    30383078  UInt i,uiMaxNumCoeff = g_scalingListSize[size];
     
    30473087  for(i=0;i<uiMaxNumCoeff;i++)
    30483088  {
    3049     pdErrScale[i] =  dErrScale / piQuantcoeff[i] / piQuantcoeff[i] / (1 << DISTORTION_PRECISION_ADJUSTMENT(2 * (g_bitDepth[channelType] - 8)));
    3050   }
    3051 
    3052   getErrScaleCoeffNoScalingList(list, size, qp) = dErrScale / g_quantScales[qp] / g_quantScales[qp] / (1 << DISTORTION_PRECISION_ADJUSTMENT(2 * (g_bitDepth[channelType] - 8)));
     3089    pdErrScale[i] =  dErrScale / piQuantcoeff[i] / piQuantcoeff[i] / (1 << DISTORTION_PRECISION_ADJUSTMENT(2 * (bitDepths.recon[channelType] - 8)));
     3090  }
     3091
     3092  getErrScaleCoeffNoScalingList(list, size, qp) = dErrScale / g_quantScales[qp] / g_quantScales[qp] / (1 << DISTORTION_PRECISION_ADJUSTMENT(2 * (bitDepths.recon[channelType] - 8)));
    30533093}
    30543094
     
    31083148/** set flat matrix value to quantized coefficient
    31093149 */
    3110 Void TComTrQuant::setFlatScalingList(const ChromaFormat format, const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE])
     3150Void TComTrQuant::setFlatScalingList(const ChromaFormat format, const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE], const BitDepths &bitDepths)
    31113151{
    31123152  const Int minimumQp = 0;
     
    31203160      {
    31213161        xsetFlatScalingList(list,size,qp,format);
    3122         setErrScaleCoeff(list,size,qp,maxLog2TrDynamicRange);
     3162        setErrScaleCoeff(list,size,qp,maxLog2TrDynamicRange, bitDepths);
    31233163      }
    31243164    }
     
    32563296  const UInt           uiHeight                       = rect.height;
    32573297  const Int            maxLog2TrDynamicRange          = pcCU->getSlice()->getSPS()->getMaxLog2TrDynamicRange(toChannelType(compID));
    3258   const Int            iTransformShift                = getTransformShift(toChannelType(compID), rTu.GetEquivalentLog2TrSize(compID), maxLog2TrDynamicRange);
     3298#if SVC_EXTENSION
     3299  const Int            channelBitDepth                = pcCU->getSlice()->getBitDepth(toChannelType(compID));
     3300#else
     3301  const Int            channelBitDepth                = pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID));
     3302#endif
     3303  const Int            iTransformShift                = getTransformShift(channelBitDepth, rTu.GetEquivalentLog2TrSize(compID), maxLog2TrDynamicRange);
    32593304  const Int            scalingListType                = getScalingListType(pcCU->getPredictionMode(uiAbsPartIdx), compID);
    32603305  const Bool           enableScalingLists             = getUseScalingList(uiWidth, uiHeight, true);
     
    33153360  const Int            QP_rem             = cQP.rem;
    33163361  const Int            maxLog2TrDynamicRange = pcCU->getSlice()->getSPS()->getMaxLog2TrDynamicRange(toChannelType(compID));
    3317   const Int            iTransformShift    = getTransformShift(toChannelType(compID), rTu.GetEquivalentLog2TrSize(compID), maxLog2TrDynamicRange);
     3362#if O0043_BEST_EFFORT_DECODING
     3363  const Int            channelBitDepth    = pcCU->getSlice()->getSPS()->getStreamBitDepth(toChannelType(compID));
     3364#else
     3365#if SVC_EXTENSION
     3366  const Int            channelBitDepth    = pcCU->getSlice()->getBitDepth(toChannelType(compID));
     3367#else
     3368  const Int            channelBitDepth    = pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID));
     3369#endif
     3370#endif
     3371  const Int            iTransformShift    = getTransformShift(channelBitDepth, rTu.GetEquivalentLog2TrSize(compID), maxLog2TrDynamicRange);
    33183372  const Int            scalingListType    = getScalingListType(pcCU->getPredictionMode(uiAbsPartIdx), compID);
    33193373  const Bool           enableScalingLists = getUseScalingList(uiWidth, uiHeight, true);
  • branches/SHM-dev/source/Lib/TLibCommon/TComTrQuant.h

    r1285 r1287  
    172172  Void initScalingList                      ();
    173173  Void destroyScalingList                   ();
    174   Void setErrScaleCoeff    ( UInt list, UInt size, Int qp, const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE] );
     174  Void setErrScaleCoeff    ( UInt list, UInt size, Int qp, const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE], const BitDepths &bitDepths );
    175175  Double* getErrScaleCoeff              ( UInt list, UInt size, Int qp ) { return m_errScale             [size][list][qp]; };  //!< get Error Scale Coefficent
    176176  Double& getErrScaleCoeffNoScalingList ( UInt list, UInt size, Int qp ) { return m_errScaleNoScalingList[size][list][qp]; };  //!< get Error Scale Coefficent
     
    179179  Void setUseScalingList   ( Bool bUseScalingList){ m_scalingListEnabledFlag = bUseScalingList; };
    180180  Bool getUseScalingList   (const UInt width, const UInt height, const Bool isTransformSkip){ return m_scalingListEnabledFlag && (!isTransformSkip || ((width == 4) && (height == 4))); };
    181   Void setFlatScalingList  (const ChromaFormat format, const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE]);
     181  Void setFlatScalingList  (const ChromaFormat format, const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE], const BitDepths &bitDepths);
    182182  Void xsetFlatScalingList ( UInt list, UInt size, Int qp, const ChromaFormat format);
    183183  Void xSetScalingListEnc  ( TComScalingList *scalingList, UInt list, UInt size, Int qp, const ChromaFormat format);
    184184  Void xSetScalingListDec  ( const TComScalingList &scalingList, UInt list, UInt size, Int qp, const ChromaFormat format);
    185   Void setScalingList      ( TComScalingList *scalingList, const ChromaFormat format, const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE]);
     185  Void setScalingList      ( TComScalingList *scalingList, const ChromaFormat format, const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE], const BitDepths &bitDepths);
    186186  Void setScalingListDec   ( const TComScalingList &scalingList, const ChromaFormat format);
    187187  Void processScalingListEnc( Int *coeff, Int *quantcoeff, Int quantScales, UInt height, UInt width, UInt ratio, Int sizuNum, UInt dc);
     
    230230private:
    231231  // forward Transform
    232   Void xT   ( const ComponentID compID, Bool useDST, Pel* piBlkResi, UInt uiStride, TCoeff* psCoeff, Int iWidth, Int iHeight, const Int maxLog2TrDynamicRange );
     232  Void xT   ( const Int channelBitDepth, Bool useDST, Pel* piBlkResi, UInt uiStride, TCoeff* psCoeff, Int iWidth, Int iHeight, const Int maxLog2TrDynamicRange );
    233233
    234234  // skipping Transform
     
    304304
    305305  // inverse transform
    306   Void xIT    ( const ComponentID compID, Bool useDST, TCoeff* plCoef, Pel* pResidual, UInt uiStride, Int iWidth, Int iHeight, const Int maxLog2TrDynamicRange );
     306  Void xIT    ( const Int channelBitDepth, Bool useDST, TCoeff* plCoef, Pel* pResidual, UInt uiStride, Int iWidth, Int iHeight, const Int maxLog2TrDynamicRange );
    307307
    308308  // inverse skipping transform
  • branches/SHM-dev/source/Lib/TLibCommon/TComUpsampleFilter.cpp

    r1235 r1287  
    5151}
    5252
    53 Void TComUpsampleFilter::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic )
     53Void TComUpsampleFilter::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Int refBitDepthLuma, const Int refBitDepthChroma )
    5454{
    5555  assert ( NTAPS_US_LUMA == 8 );
     
    6363  const Window &scalEL = currSlice->getPPS()->getScaledRefLayerWindowForLayer(refLayerId);
    6464  const Window &windowRL = currSlice->getPPS()->getRefLayerWindowForLayer(refLayerId);
     65
     66  Int bitDepthLuma = currSlice->getBitDepth(CHANNEL_TYPE_LUMA);
     67  Int bitDepthChroma = currSlice->getBitDepth(CHANNEL_TYPE_CHROMA);
    6568
    6669  //========== Y component upsampling ===========
     
    115118    piDstY = piDstBufY + scalEL.getWindowLeftOffset() + scalEL.getWindowTopOffset() * strideEL;
    116119
    117     Int shift = g_bitDepthLayer[CHANNEL_TYPE_LUMA][currLayerId] - g_bitDepthLayer[CHANNEL_TYPE_LUMA][refLayerId];
     120    Int shift = bitDepthLuma - refBitDepthLuma;
    118121
    119122#if CGS_3D_ASYMLUT
    120123    if( currSlice->getPPS()->getCGSFlag() )
    121124    {
    122       shift = g_bitDepthLayer[CHANNEL_TYPE_LUMA][currLayerId] - currSlice->getPPS()->getCGSOutputBitDepthY();
     125      shift = bitDepthLuma - currSlice->getPPS()->getCGSOutputBitDepthY();
    123126    }
    124127    assert( shift >= 0 );
     
    151154    piDstV = piDstBufV + ( scalEL.getWindowLeftOffset() >> 1 ) + ( scalEL.getWindowTopOffset() >> 1 ) * strideEL;
    152155
    153     shift = g_bitDepthLayer[CHANNEL_TYPE_CHROMA][currLayerId] - g_bitDepthLayer[CHANNEL_TYPE_CHROMA][refLayerId];
     156    shift = bitDepthChroma - refBitDepthChroma;
    154157
    155158#if CGS_3D_ASYMLUT
    156159    if( currSlice->getPPS()->getCGSFlag() )
    157160    {
    158       shift = g_bitDepthLayer[CHANNEL_TYPE_CHROMA][currLayerId] - currSlice->getPPS()->getCGSOutputBitDepthC();
     161      shift = currSlice->getBitDepth(CHANNEL_TYPE_CHROMA) - currSlice->getPPS()->getCGSOutputBitDepthC();
    159162    }
    160163#endif
     
    218221
    219222    // g_bitDepthY was set to EL bit-depth, but shift1 should be calculated using BL bit-depth
    220     Int shift1 = g_bitDepthLayer[CHANNEL_TYPE_LUMA][refLayerId] - 8;
     223    Int shift1 = refBitDepthLuma - 8;
    221224
    222225#if CGS_3D_ASYMLUT
     
    254257    pcTempPic->setHeight(heightEL);
    255258
    256     Int nShift = 20 - g_bitDepthLayer[CHANNEL_TYPE_LUMA][currLayerId];
     259    Int nShift = 20 - bitDepthLuma;
    257260    Int iOffset = 1 << (nShift - 1);
    258261
     
    273276      for( i = pcTempPic->getWidth(COMPONENT_Y); i > 0; i-- )
    274277      {
    275         *piDstY = Clip( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift), CHANNEL_TYPE_LUMA );
     278        *piDstY = ClipBD( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift), bitDepthLuma );
    276279        piSrcY++;
    277280        piDstY++;
     
    318321
    319322    // g_bitDepthC was set to EL bit-depth, but shift1 should be calculated using BL bit-depth
    320     shift1 = g_bitDepthLayer[CHANNEL_TYPE_CHROMA][refLayerId] - 8;
     323    shift1 = refBitDepthChroma - 8;
    321324
    322325#if CGS_3D_ASYMLUT
     
    360363    pcTempPic->setHeight(heightEL << 1);
    361364
    362     nShift = 20 - g_bitDepthLayer[CHANNEL_TYPE_CHROMA][currLayerId];
     365    nShift = 20 - bitDepthChroma;
    363366
    364367    iOffset = 1 << (nShift - 1);
     
    384387      for( i = pcTempPic->getWidth(COMPONENT_Y) >> 1; i > 0; i-- )
    385388      {
    386         *piDstU = Clip( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift), CHANNEL_TYPE_CHROMA );
    387         *piDstV = Clip( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift), CHANNEL_TYPE_CHROMA );
     389        *piDstU = ClipBD( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift), bitDepthChroma );
     390        *piDstV = ClipBD( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift), bitDepthChroma );
    388391        piSrcU++;
    389392        piSrcV++;
  • branches/SHM-dev/source/Lib/TLibCommon/TComUpsampleFilter.h

    r1090 r1287  
    4242  TComUpsampleFilter(void);
    4343  ~TComUpsampleFilter(void);
    44   Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic );
     44  Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Int refBitDepthLuma, const Int refBitDepthChroma );
    4545
    4646};
  • branches/SHM-dev/source/Lib/TLibCommon/TComWeightPrediction.cpp

    r1262 r1287  
    6767Void TComWeightPrediction::addWeightBi( const TComYuv              *pcYuvSrc0,
    6868                                        const TComYuv              *pcYuvSrc1,
     69                                        const BitDepths            &bitDepths,
    6970                                        const UInt                  iPartUnitIdx,
    7071                                        const UInt                  uiWidth,
     
    7374                                        const WPScalingParam *const wp1,
    7475                                              TComYuv        *const rpcYuvDst,
    75                                         const Bool                  bRoundLuma )
     76                                        const Bool                  bRoundLuma)
    7677{
    7778
     
    9192    const Int  w0          = wp0[compID].w;
    9293    const Int  offset      = wp0[compID].offset;
    93     const Int  clipBD      = g_bitDepth[toChannelType(compID)];
     94    const Int  clipBD      = bitDepths.recon[toChannelType(compID)];
    9495    const Int  shiftNum    = std::max<Int>(2, (IF_INTERNAL_PREC - clipBD));
    9596    const Int  shift       = wp0[compID].shift + shiftNum;
     
    131132//! weighted averaging for uni-pred
    132133Void TComWeightPrediction::addWeightUni( const TComYuv        *const pcYuvSrc0,
     134                                         const BitDepths            &bitDepths,
    133135                                         const UInt                  iPartUnitIdx,
    134136                                         const UInt                  uiWidth,
     
    149151    const Int  w0          = wp0[compID].w;
    150152    const Int  offset      = wp0[compID].offset;
    151     const Int  clipBD      = g_bitDepth[toChannelType(compID)];
     153    const Int  clipBD      = bitDepths.recon[toChannelType(compID)];
    152154    const Int  shiftNum    = std::max<Int>(2, (IF_INTERNAL_PREC - clipBD));
    153155    const Int  shift       = wp0[compID].shift + shiftNum;
     
    230232    for ( Int yuv=0 ; yuv<numValidComponent ; yuv++ )
    231233    {
    232       const Int bitDepth            = g_bitDepth[toChannelType(ComponentID(yuv))];
     234#if SVC_EXTENSION
     235      const Int bitDepth            = pcSlice->getBitDepth(toChannelType(ComponentID(yuv)));
     236#else
     237      const Int bitDepth            = pcSlice->getSPS()->getBitDepth(toChannelType(ComponentID(yuv)));
     238#endif
    233239      const Int offsetScalingFactor = bUseHighPrecisionPredictionWeighting ? 1 : (1 << (bitDepth-8));
    234240
     
    251257    for ( Int yuv=0 ; yuv<numValidComponent ; yuv++ )
    252258    {
    253       const Int bitDepth            = g_bitDepth[toChannelType(ComponentID(yuv))];
     259#if SVC_EXTENSION
     260      const Int bitDepth            = pcSlice->getBitDepth(toChannelType(ComponentID(yuv)));
     261#else
     262      const Int bitDepth            = pcSlice->getSPS()->getBitDepth(toChannelType(ComponentID(yuv)));
     263#endif
    254264      const Int offsetScalingFactor = bUseHighPrecisionPredictionWeighting ? 1 : (1 << (bitDepth-8));
    255265
     
    283293  if( iRefIdx0 >= 0 && iRefIdx1 >= 0 )
    284294  {
    285     addWeightBi(pcYuvSrc0, pcYuvSrc1, uiPartIdx, iWidth, iHeight, pwp0, pwp1, rpcYuvDst );
     295#if SVC_EXTENSION
     296    addWeightBi(pcYuvSrc0, pcYuvSrc1, pcCU->getSlice()->getBitDepths(), uiPartIdx, iWidth, iHeight, pwp0, pwp1, rpcYuvDst );
     297#else
     298    addWeightBi(pcYuvSrc0, pcYuvSrc1, pcCU->getSlice()->getSPS()->getBitDepths(), uiPartIdx, iWidth, iHeight, pwp0, pwp1, rpcYuvDst );
     299#endif
    286300  }
    287301  else if ( iRefIdx0 >= 0 && iRefIdx1 <  0 )
    288302  {
    289     addWeightUni( pcYuvSrc0, uiPartIdx, iWidth, iHeight, pwp0, rpcYuvDst );
     303#if SVC_EXTENSION
     304    addWeightUni( pcYuvSrc0, pcCU->getSlice()->getBitDepths(), uiPartIdx, iWidth, iHeight, pwp0, rpcYuvDst );
     305#else
     306    addWeightUni( pcYuvSrc0, pcCU->getSlice()->getSPS()->getBitDepths(), uiPartIdx, iWidth, iHeight, pwp0, rpcYuvDst );
     307#endif
    290308  }
    291309  else if ( iRefIdx0 <  0 && iRefIdx1 >= 0 )
    292310  {
    293     addWeightUni( pcYuvSrc1, uiPartIdx, iWidth, iHeight, pwp1, rpcYuvDst );
     311#if SVC_EXTENSION
     312    addWeightUni( pcYuvSrc1, pcCU->getSlice()->getBitDepths(), uiPartIdx, iWidth, iHeight, pwp1, rpcYuvDst );
     313#else
     314    addWeightUni( pcYuvSrc1, pcCU->getSlice()->getSPS()->getBitDepths(), uiPartIdx, iWidth, iHeight, pwp1, rpcYuvDst );
     315#endif
    294316  }
    295317  else
     
    327349    getWpScaling(pcCU, -1, iRefIdx, pwpTmp, pwp);
    328350  }
    329   addWeightUni( pcYuvSrc, uiPartAddr, iWidth, iHeight, pwp, pcYuvPred );
    330 }
     351#if SVC_EXTENSION
     352  addWeightUni( pcYuvSrc, pcCU->getSlice()->getBitDepths(), uiPartAddr, iWidth, iHeight, pwp, pcYuvPred );
     353#else
     354  addWeightUni( pcYuvSrc, pcCU->getSlice()->getSPS()->getBitDepths(), uiPartAddr, iWidth, iHeight, pwp, pcYuvPred );
     355#endif
     356}
  • branches/SHM-dev/source/Lib/TLibCommon/TComWeightPrediction.h

    r1262 r1287  
    6363  Void addWeightBi(             const TComYuv              *pcYuvSrc0,
    6464                                const TComYuv              *pcYuvSrc1,
     65                                const BitDepths            &bitDepths,
    6566                                const UInt                  iPartUnitIdx,
    6667                                const UInt                  uiWidth,
     
    7273
    7374  Void  addWeightUni(           const TComYuv        *const pcYuvSrc0,
     75                                const BitDepths            &bitDepths,
    7476                                const UInt                  iPartUnitIdx,
    7577                                const UInt                  uiWidth,
  • branches/SHM-dev/source/Lib/TLibCommon/TComYuv.cpp

    r1259 r1287  
    278278
    279279
    280 Void TComYuv::addClip( const TComYuv* pcYuvSrc0, const TComYuv* pcYuvSrc1, const UInt uiTrUnitIdx, const UInt uiPartSize )
     280Void TComYuv::addClip( const TComYuv* pcYuvSrc0, const TComYuv* pcYuvSrc1, const UInt uiTrUnitIdx, const UInt uiPartSize, const BitDepths &clipBitDepths )
    281281{
    282282  for(Int chan=0; chan<getNumberValidComponents(); chan++)
     
    293293    const UInt iSrc1Stride = pcYuvSrc1->getStride(ch);
    294294    const UInt iDstStride  = getStride(ch);
    295     const Int clipbd = g_bitDepth[toChannelType(ch)];
     295    const Int clipbd = clipBitDepths.recon[toChannelType(ch)];
    296296#if O0043_BEST_EFFORT_DECODING
    297     const Int bitDepthDelta = g_bitDepthInStream[toChannelType(ch)] - g_bitDepth[toChannelType(ch)];
     297    const Int bitDepthDelta = clipBitDepths.stream[toChannelType(ch)] - clipbd;
    298298#endif
    299299
     
    350350
    351351
    352 Void TComYuv::addAvg( const TComYuv* pcYuvSrc0, const TComYuv* pcYuvSrc1, const UInt iPartUnitIdx, const UInt uiWidth, const UInt uiHeight )
     352Void TComYuv::addAvg( const TComYuv* pcYuvSrc0, const TComYuv* pcYuvSrc1, const UInt iPartUnitIdx, const UInt uiWidth, const UInt uiHeight, const BitDepths &clipBitDepths )
    353353{
    354354  for(Int chan=0; chan<getNumberValidComponents(); chan++)
     
    362362    const UInt  iSrc1Stride = pcYuvSrc1->getStride(ch);
    363363    const UInt  iDstStride  = getStride(ch);
    364     const Int   clipbd      = g_bitDepth[toChannelType(ch)];
     364    const Int   clipbd      = clipBitDepths.recon[toChannelType(ch)];
    365365    const Int   shiftNum    = std::max<Int>(2, (IF_INTERNAL_PREC - clipbd)) + 1;
    366366    const Int   offset      = ( 1 << ( shiftNum - 1 ) ) + 2 * IF_INTERNAL_OFFS;
  • branches/SHM-dev/source/Lib/TLibCommon/TComYuv.h

    r1262 r1287  
    131131
    132132  //  Clip(pcYuvSrc0 + pcYuvSrc1) -> m_apiBuf
    133   Void         addClip                    ( const TComYuv* pcYuvSrc0, const TComYuv* pcYuvSrc1, const UInt uiTrUnitIdx, const UInt uiPartSize );
     133  Void         addClip                    ( const TComYuv* pcYuvSrc0, const TComYuv* pcYuvSrc1, const UInt uiTrUnitIdx, const UInt uiPartSize, const BitDepths &clipBitDepths );
    134134
    135135  //  pcYuvSrc0 - pcYuvSrc1 -> m_apiBuf
     
    137137
    138138  //  (pcYuvSrc0 + pcYuvSrc1)/2 for YUV partition
    139   Void         addAvg                     ( const TComYuv* pcYuvSrc0, const TComYuv* pcYuvSrc1, const UInt iPartUnitIdx, const UInt iWidth, const UInt iHeight );
     139  Void         addAvg                     ( const TComYuv* pcYuvSrc0, const TComYuv* pcYuvSrc1, const UInt iPartUnitIdx, const UInt iWidth, const UInt iHeight, const BitDepths &clipBitDepths );
    140140
    141141  Void         removeHighFreq             ( const TComYuv* pcYuvSrc, const UInt uiPartIdx, const UInt uiWidth, const UInt uiHeight );
  • branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h

    r1273 r1287  
    842842
    843843
     844struct BitDepths
     845{
     846#if O0043_BEST_EFFORT_DECODING
     847  Int recon[MAX_NUM_CHANNEL_TYPE]; ///< the bit depth used for reconstructing the video
     848  Int stream[MAX_NUM_CHANNEL_TYPE];///< the bit depth used indicated in the SPS
     849#else
     850  Int recon[MAX_NUM_CHANNEL_TYPE]; ///< the bit depth as indicated in the SPS
     851#endif
     852
     853#if SVC_EXTENSION
     854  BitDepths()
     855  {
     856  }
     857  BitDepths(Int bitDepthY, Int bitDepthC)
     858  {
     859    recon[CHANNEL_TYPE_LUMA] = bitDepthY;
     860    recon[CHANNEL_TYPE_CHROMA] = bitDepthC;
     861  }
     862#endif
     863};
     864
    844865/// parameters for deblocking filter
    845866typedef struct _LFCUParam
Note: See TracChangeset for help on using the changeset viewer.